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.
This commit is contained in:
Paul Eggert 2016-01-10 21:41:59 -08:00
parent 552694a265
commit eef6784ea4
2 changed files with 13 additions and 13 deletions

View 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);

View 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);