]> code.delx.au - gnu-emacs/commitdiff
Simplify HAVE_MODULES use in mark_maybe_pointer
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 11 Jan 2016 05:41:59 +0000 (21:41 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 11 Jan 2016 05:46:37 +0000 (21:46 -0800)
* 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
src/lisp.h

index 9d876a51469d6f55587beeccdc7846e6a8c59cb4..8ceacfe8ead44d52e55b620cd270fdf3f3f3e819 100644 (file)
@@ -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);
index 15aa2e883e48bc6f8339d99f7566e1ecdf509690..f33a8f2494e688e52f9cbd8693ec7816550ed43f 100644 (file)
@@ -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);