aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
authorHelmut Eller2024-06-23 21:46:16 +0200
committerHelmut Eller2026-02-12 18:51:51 +0100
commit9008e6a9d7f041875c2fe9f58d5b5b44e84f649f (patch)
tree3773e8290f1cf06b1b57de3182eeb77014ca9845 /src/buffer.c
parent3442fdd2a2d9702bf9ed856b9bf0a0b1d0992747 (diff)
downloademacs-9008e6a9d7f041875c2fe9f58d5b5b44e84f649f.tar.gz
emacs-9008e6a9d7f041875c2fe9f58d5b5b44e84f649f.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 cc559ad0ad6..afc2f0f4d89 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -4980,19 +4980,15 @@ init_buffer (void)
4980 that nil is allowed too). DOC is a dummy where you write the doc 4980 that nil is allowed too). DOC is a dummy where you write the doc
4981 string as a comment. */ 4981 string as a comment. */
4982 4982
4983/* FIXME: use LISPSYM_INITIALLY instead of TAG_PTR_INITIALLY */ 4983#define DEFVAR_PER_BUFFER(lname, vname, predicate, doc) \
4984#define DEFVAR_PER_BUFFER(lname, vname, predicate_, doc) \ 4984 do { \
4985 do { \ 4985 static const struct Lisp_Fwd bo_fwd \
4986 const Lisp_Object sym \ 4986 = { .type = Lisp_Fwd_Buffer_Obj, \
4987 = TAG_PTR_INITIALLY (Lisp_Symbol, (intptr_t)((i##predicate_) \ 4987 .bufoffset = offsetof (struct buffer, vname##_), \
4988 * sizeof *lispsym)); \ 4988 .u.bufpredicate = FWDPRED_##predicate }; \
4989 static const struct Lisp_Fwd bo_fwd \ 4989 static_assert (offsetof (struct buffer, vname##_) \
4990 = { .type = Lisp_Fwd_Buffer_Obj, \ 4990 < (1 << 8 * sizeof bo_fwd.bufoffset)); \
4991 .bufoffset = offsetof (struct buffer, vname##_), \ 4991 defvar_per_buffer (&bo_fwd, lname); \
4992 .u.bufpredicate = sym }; \
4993 static_assert (offsetof (struct buffer, vname##_) \
4994 < (1 << 8 * sizeof bo_fwd.bufoffset)); \
4995 defvar_per_buffer (&bo_fwd, lname); \
4996 } while (0) 4992 } while (0)
4997 4993
4998static void 4994static void