Commit e7cb6eea authored by Philipp Stephani's avatar Philipp Stephani

Remove some #ifdefs for user pointers.

Even if Emacs is compiled without module support, we don't have to
comment out every bit of user pointer support.  Defining the basic
structures and functions and detecting user pointers in switch
statements is harmless, and we're already doing the same for module
functions.  Removing these #ifdefs makes the code a bit easier to
read.

* src/lisp.h (PVEC_USER_PTR, struct Lisp_User_Ptr, USER_PTRP)
(XUSER_PTR): Define unconditionally.

* src/data.c (Ftype_of):
* src/alloc.c (cleanup_vector):
* src/print.c (print_vectorlike):
* src/pdumper.c (dump_vectorlike): Remove #ifdef for user pointers.
parent 7e7d62ea
......@@ -3270,14 +3270,12 @@ cleanup_vector (struct Lisp_Vector *vector)
/* sweep_buffer should already have unchained this from its buffer. */
eassert (! PSEUDOVEC_STRUCT (vector, Lisp_Marker)->buffer);
}
#ifdef HAVE_MODULES
else if (PSEUDOVECTOR_TYPEP (&vector->header, PVEC_USER_PTR))
{
struct Lisp_User_Ptr *uptr = PSEUDOVEC_STRUCT (vector, Lisp_User_Ptr);
if (uptr->finalizer)
uptr->finalizer (uptr->p);
}
#endif
}
/* Reclaim space used by unmarked vectors. */
......
......@@ -230,9 +230,7 @@ for example, (type-of 1) returns `integer'. */)
case PVEC_MARKER: return Qmarker;
case PVEC_OVERLAY: return Qoverlay;
case PVEC_FINALIZER: return Qfinalizer;
#ifdef HAVE_MODULES
case PVEC_USER_PTR: return Quser_ptr;
#endif
case PVEC_WINDOW_CONFIGURATION: return Qwindow_configuration;
case PVEC_PROCESS: return Qprocess;
case PVEC_WINDOW: return Qwindow;
......
......@@ -1097,9 +1097,7 @@ enum pvec_type
PVEC_OVERLAY,
PVEC_FINALIZER,
PVEC_MISC_PTR,
#ifdef HAVE_MODULES
PVEC_USER_PTR,
#endif
PVEC_PROCESS,
PVEC_FRAME,
PVEC_WINDOW,
......@@ -2561,14 +2559,12 @@ xmint_pointer (Lisp_Object a)
return XUNTAG (a, Lisp_Vectorlike, struct Lisp_Misc_Ptr)->pointer;
}
#ifdef HAVE_MODULES
struct Lisp_User_Ptr
{
union vectorlike_header header;
void (*finalizer) (void *);
void *p;
} GCALIGNED_STRUCT;
#endif
/* A finalizer sentinel. */
struct Lisp_Finalizer
......@@ -2627,7 +2623,6 @@ XOVERLAY (Lisp_Object a)
return XUNTAG (a, Lisp_Vectorlike, struct Lisp_Overlay);
}
#ifdef HAVE_MODULES
INLINE bool
USER_PTRP (Lisp_Object x)
{
......@@ -2640,7 +2635,6 @@ XUSER_PTR (Lisp_Object a)
eassert (USER_PTRP (a));
return XUNTAG (a, Lisp_Vectorlike, struct Lisp_User_Ptr);
}
#endif
INLINE bool
BIGNUMP (Lisp_Object x)
......
......@@ -3013,9 +3013,7 @@ dump_vectorlike (struct dump_context *ctx,
case PVEC_XWIDGET_VIEW:
error_unsupported_dump_object (ctx, lv, "xwidget view");
case PVEC_MISC_PTR:
#ifdef HAVE_MODULES
case PVEC_USER_PTR:
#endif
error_unsupported_dump_object (ctx, lv, "smuggled pointers");
case PVEC_THREAD:
if (main_thread_p (v))
......
......@@ -1410,7 +1410,6 @@ print_vectorlike (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag,
printchar ('>', printcharfun);
break;
#ifdef HAVE_MODULES
case PVEC_USER_PTR:
{
print_c_string ("#<user-ptr ", printcharfun);
......@@ -1421,7 +1420,6 @@ print_vectorlike (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag,
printchar ('>', printcharfun);
}
break;
#endif
case PVEC_FINALIZER:
print_c_string ("#<finalizer", printcharfun);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment