aboutsummaryrefslogtreecommitdiffstats
path: root/src/lisp.h
diff options
context:
space:
mode:
authorPaul Eggert2015-01-09 08:04:36 -0800
committerPaul Eggert2015-01-09 08:22:35 -0800
commitd1f848ffb9896fe2bd8eb9e7d70a49ca9ff9522f (patch)
tree8789ccadf4cf2651edeec31aec5dc4695a399e88 /src/lisp.h
parenta749f1c648f2b9bf1a0b0b10e2da4c1c4e3d431d (diff)
downloademacs-d1f848ffb9896fe2bd8eb9e7d70a49ca9ff9522f.tar.gz
emacs-d1f848ffb9896fe2bd8eb9e7d70a49ca9ff9522f.zip
Refactor pointer-to-integer conversion
* gfilenotify.c (monitor_to_lisp, lisp_to_monitor): Rename and move to lisp.h. All uses changed. * lisp.h (XINTPTR, make_pointer_integer): New inline functions, which are renamed from gfilenotify.c's lisp_to_monitor and monitor_to_lisp, and with more-generic void * signatures.
Diffstat (limited to 'src/lisp.h')
-rw-r--r--src/lisp.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/lisp.h b/src/lisp.h
index 5a4198ef683..4571c455a7b 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1112,6 +1112,25 @@ make_lisp_proc (struct Lisp_Process *p)
1112#define XSETBOOL_VECTOR(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_BOOL_VECTOR)) 1112#define XSETBOOL_VECTOR(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_BOOL_VECTOR))
1113#define XSETSUB_CHAR_TABLE(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_SUB_CHAR_TABLE)) 1113#define XSETSUB_CHAR_TABLE(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_SUB_CHAR_TABLE))
1114 1114
1115/* Efficiently convert a pointer to a Lisp object and back. The
1116 pointer is represented as a Lisp integer, so the garbage collector
1117 does not know about it. The pointer should not have both Lisp_Int1
1118 bits set, which makes this conversion inherently unportable. */
1119
1120INLINE void *
1121XINTPTR (Lisp_Object a)
1122{
1123 return XUNTAG (a, Lisp_Int0);
1124}
1125
1126INLINE Lisp_Object
1127make_pointer_integer (void *p)
1128{
1129 Lisp_Object a = XIL (TAG_PTR (Lisp_Int0, p));
1130 eassert (INTEGERP (a) && XINTPTR (a) == p);
1131 return a;
1132}
1133
1115/* Type checking. */ 1134/* Type checking. */
1116 1135
1117LISP_MACRO_DEFUN_VOID (CHECK_TYPE, 1136LISP_MACRO_DEFUN_VOID (CHECK_TYPE,