From e7cb6eea99a09335c8f5b935336ee6442468d853 Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Fri, 19 Apr 2019 23:07:58 +0200 Subject: [PATCH] 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. --- src/alloc.c | 2 -- src/data.c | 2 -- src/lisp.h | 6 ------ src/pdumper.c | 2 -- src/print.c | 2 -- 5 files changed, 14 deletions(-) diff --git a/src/alloc.c b/src/alloc.c index 70701d75d47..7f0443dc2ea 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -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. */ diff --git a/src/data.c b/src/data.c index 1b2431011e9..596b7783747 100644 --- a/src/data.c +++ b/src/data.c @@ -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; diff --git a/src/lisp.h b/src/lisp.h index 2aa767b86c2..c2cb89de9d5 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -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) diff --git a/src/pdumper.c b/src/pdumper.c index 1bd94cb0036..cb36f7e4b4a 100644 --- a/src/pdumper.c +++ b/src/pdumper.c @@ -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)) diff --git a/src/print.c b/src/print.c index 67c4ed03ee8..081e5574b73 100644 --- a/src/print.c +++ b/src/print.c @@ -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 ("#', printcharfun); } break; -#endif case PVEC_FINALIZER: print_c_string ("#