aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
authorPaul Eggert2013-07-01 20:41:16 -0700
committerPaul Eggert2013-07-01 20:41:16 -0700
commit52a9bcae40a1c8536cf70cc4622a6877024e4b36 (patch)
tree90f239c0a7f16286c3938b1e1f4c8b72ce56b1e9 /src/alloc.c
parentbb70a65f1de65b5abf87c0b43d03e55ed6e579f6 (diff)
downloademacs-52a9bcae40a1c8536cf70cc4622a6877024e4b36.tar.gz
emacs-52a9bcae40a1c8536cf70cc4622a6877024e4b36.zip
Don't convert function pointers to void * and back.
It isn't portable C, and it's easy enough to avoid. * alloc.c: Verify SAVE_FUNCPOINTER bits, too. (make_save_value): Add support for SAVE_FUNCPOINTER. * keymap.c (map_keymap_char_table_item, map_keymap_internal): * print.c (print_object): Distinguish function from object pointers. * lisp.h (SAVE_FUNCPOINTER): New constant. (SAVE_SLOT_BITS): Adjust to it. (SAVE_TYPE_FUNCPTR_PTR_OBJ): New constant, replacing SAVE_TYPE_PTR_PTR_OBJ. Change the only use. (voidfuncptr): New typedef. (struct Lisp_Save_Value): New member data[0].funcpointer. (XSAVE_FUNCPOINTER): New function.
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/alloc.c b/src/alloc.c
index eaef0d4b797..b625e1f27e0 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -3352,7 +3352,9 @@ free_misc (Lisp_Object misc)
3352 that are assumed here and elsewhere. */ 3352 that are assumed here and elsewhere. */
3353 3353
3354verify (SAVE_UNUSED == 0); 3354verify (SAVE_UNUSED == 0);
3355verify ((SAVE_INTEGER | SAVE_POINTER | SAVE_OBJECT) >> SAVE_SLOT_BITS == 0); 3355verify (((SAVE_INTEGER | SAVE_POINTER | SAVE_FUNCPOINTER | SAVE_OBJECT)
3356 >> SAVE_SLOT_BITS)
3357 == 0);
3356 3358
3357/* Return a Lisp_Save_Value object with the data saved according to 3359/* Return a Lisp_Save_Value object with the data saved according to
3358 DATA_TYPE. DATA_TYPE should be one of SAVE_TYPE_INT_INT, etc. */ 3360 DATA_TYPE. DATA_TYPE should be one of SAVE_TYPE_INT_INT, etc. */
@@ -3379,6 +3381,10 @@ make_save_value (enum Lisp_Save_Type save_type, ...)
3379 p->data[i].pointer = va_arg (ap, void *); 3381 p->data[i].pointer = va_arg (ap, void *);
3380 break; 3382 break;
3381 3383
3384 case SAVE_FUNCPOINTER:
3385 p->data[i].funcpointer = va_arg (ap, voidfuncptr);
3386 break;
3387
3382 case SAVE_INTEGER: 3388 case SAVE_INTEGER:
3383 p->data[i].integer = va_arg (ap, ptrdiff_t); 3389 p->data[i].integer = va_arg (ap, ptrdiff_t);
3384 break; 3390 break;