aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
authorHelmut Eller2024-06-23 21:46:16 +0200
committerGerd Möllmann2024-06-24 05:32:53 +0200
commit2ef995c59179aac5df4c3223196f3b5602246992 (patch)
tree1ce047f60312907dbc0e3ec5044df2b20113643b /src/buffer.c
parent314fdc45ad63a059fe24b2b75f32eae8c431216f (diff)
downloademacs-2ef995c59179aac5df4c3223196f3b5602246992.tar.gz
emacs-2ef995c59179aac5df4c3223196f3b5602246992.zip
Introduce an enum Lisp_Fwd_Predicate
Using an enum instead of a symbol makes it obvious that this field is of no concern to the GC. * src/lisp.h (enum Lisp_Fwd_Predicate): New. (struct Lisp_Fwd): Use it instead of a symbol. * src/buffer.c (DEFVAR_PER_BUFFER): Create the necessary enum constant instead of a symbol. * src/data.c (check_fwd_predicate, check_choice): New helpers. (store_symval_forwarding): Use it.
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/buffer.c b/src/buffer.c
index ae5016df50e..39b5e29067a 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -5017,19 +5017,15 @@ init_buffer (void)
5017 that nil is allowed too). DOC is a dummy where you write the doc 5017 that nil is allowed too). DOC is a dummy where you write the doc
5018 string as a comment. */ 5018 string as a comment. */
5019 5019
5020/* FIXME: use LISPSYM_INITIALLY instead of TAG_PTR_INITIALLY */ 5020#define DEFVAR_PER_BUFFER(lname, vname, predicate, doc) \
5021#define DEFVAR_PER_BUFFER(lname, vname, predicate_, doc) \ 5021 do { \
5022 do { \ 5022 static const struct Lisp_Fwd bo_fwd \
5023 const Lisp_Object sym \ 5023 = { .type = Lisp_Fwd_Buffer_Obj, \
5024 = TAG_PTR_INITIALLY (Lisp_Symbol, (intptr_t)((i##predicate_) \ 5024 .bufoffset = offsetof (struct buffer, vname##_), \
5025 * sizeof *lispsym)); \ 5025 .u.bufpredicate = FWDPRED_##predicate }; \
5026 static const struct Lisp_Fwd bo_fwd \ 5026 static_assert (offsetof (struct buffer, vname##_) \
5027 = { .type = Lisp_Fwd_Buffer_Obj, \ 5027 < (1 << 8 * sizeof bo_fwd.bufoffset)); \
5028 .bufoffset = offsetof (struct buffer, vname##_), \ 5028 defvar_per_buffer (&bo_fwd, lname); \
5029 .u.bufpredicate = sym }; \
5030 static_assert (offsetof (struct buffer, vname##_) \
5031 < (1 << 8 * sizeof bo_fwd.bufoffset)); \
5032 defvar_per_buffer (&bo_fwd, lname); \
5033 } while (0) 5029 } while (0)
5034 5030
5035static void 5031static void