From eef6784ea4932adbce24030b171df6c09bb4736a Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 10 Jan 2016 21:41:59 -0800 Subject: [PATCH] Simplify HAVE_MODULES use in mark_maybe_pointer * src/alloc.c (HAVE_MODULES): Now a constant 0 if not defined, so that later code can use 'if' rather than '#ifdef'. (mark_maybe_pointer): Simplify based on HAVE_MODULES now always working. --- src/alloc.c | 24 ++++++++++++------------ src/lisp.h | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/alloc.c b/src/alloc.c index 9d876a51469..8ceacfe8ead 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -3732,7 +3732,7 @@ make_event_array (ptrdiff_t nargs, Lisp_Object *args) #ifdef HAVE_MODULES /* Create a new module user ptr object. */ Lisp_Object -make_user_ptr (void (*finalizer) (void*), void *p) +make_user_ptr (void (*finalizer) (void *), void *p) { Lisp_Object obj; struct Lisp_User_Ptr *uptr; @@ -4594,6 +4594,10 @@ maybe_lisp_pointer (void *p) return (uintptr_t) p % GCALIGNMENT == 0; } +#ifndef HAVE_MODULES +enum { HAVE_MODULES = false }; +#endif + /* If P points to Lisp data, mark that as live if it isn't already marked. */ @@ -4607,21 +4611,17 @@ mark_maybe_pointer (void *p) VALGRIND_MAKE_MEM_DEFINED (&p, sizeof (p)); #endif - if ( -#ifdef HAVE_MODULES - sizeof (Lisp_Object) == sizeof (void *) -#else - true -#endif - ) + if (sizeof (Lisp_Object) == sizeof (void *) || !HAVE_MODULES) { if (!maybe_lisp_pointer (p)) return; } else - /* For the wide-int case, we also have to accept emacs_value "tagged - pointers", which can be generated by emacs-module.c's value_to_lisp. */ - p = (void*)((uintptr_t) p & ~(GCALIGNMENT - 1)); + { + /* For the wide-int case, also mark emacs_value tagged pointers, + which can be generated by emacs-module.c's value_to_lisp. */ + p = (void *) ((uintptr_t) p & ~(GCALIGNMENT - 1)); + } m = mem_find (p); if (m != MEM_NIL) @@ -4729,7 +4729,7 @@ mark_memory (void *start, void *end) away. The only reference to the life string is through the pointer `s'. */ - for (pp = start; (void*)pp < end; pp = pp + GC_POINTER_ALIGNMENT) + for (pp = start; (void *) pp < end; pp += GC_POINTER_ALIGNMENT) { mark_maybe_pointer (*(void **) pp); mark_maybe_object (*(Lisp_Object *) pp); diff --git a/src/lisp.h b/src/lisp.h index 15aa2e883e4..f33a8f2494e 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -3927,7 +3927,7 @@ extern bool let_shadows_global_binding_p (Lisp_Object symbol); #ifdef HAVE_MODULES /* Defined in alloc.c. */ -extern Lisp_Object make_user_ptr (void (*finalizer) (void*), void *p); +extern Lisp_Object make_user_ptr (void (*finalizer) (void *), void *p); /* Defined in emacs-module.c. */ extern void module_init (void); -- 2.39.5