diff options
| author | Helmut Eller | 2024-06-23 17:25:21 +0200 |
|---|---|---|
| committer | Helmut Eller | 2026-02-12 18:51:51 +0100 |
| commit | 3442fdd2a2d9702bf9ed856b9bf0a0b1d0992747 (patch) | |
| tree | 90340ebf9863356a779c96dd6ef810cd3aabd5c9 /src/buffer.c | |
| parent | 163dd21e7305bbd91aecb87cb4968970d1e1e873 (diff) | |
| download | emacs-3442fdd2a2d9702bf9ed856b9bf0a0b1d0992747.tar.gz emacs-3442fdd2a2d9702bf9ed856b9bf0a0b1d0992747.zip | |
Remove struct Lisp_Buffer_Objfwd
* src/lisp.h (struct Lisp_Buffer_Objfwd): Deleted.
(struct Lisp_Fwd): Add the fields bufoffset and bufpredicate.
Make the type a 1-byte bitfield so that the entire struct still
fits in two words.
(XBUFFER_OFFSET): Renamed from XBUFFER_OBJFWD.
* src/buffer.c (DEFVAR_PER_BUFFER, defvar_per_buffer)
(buffer_local_value): Update accordingly.
* src/data.c (do_symval_forwarding, store_symval_forwarding)
(set_internal, default_value, set_default_internal)
(Fmake_local_variable, Fkill_local_variable, Flocal_variable_): Use
XBUFFER_OFFSET.
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/src/buffer.c b/src/buffer.c index 9abce241897..cc559ad0ad6 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -1402,7 +1402,7 @@ buffer_local_value (Lisp_Object variable, Lisp_Object buffer) | |||
| 1402 | { | 1402 | { |
| 1403 | lispfwd fwd = SYMBOL_FWD (sym); | 1403 | lispfwd fwd = SYMBOL_FWD (sym); |
| 1404 | if (BUFFER_OBJFWDP (fwd)) | 1404 | if (BUFFER_OBJFWDP (fwd)) |
| 1405 | result = per_buffer_value (buf, XBUFFER_OBJFWD (fwd)->offset); | 1405 | result = per_buffer_value (buf, XBUFFER_OFFSET (fwd)); |
| 1406 | else | 1406 | else |
| 1407 | result = Fdefault_value (variable); | 1407 | result = Fdefault_value (variable); |
| 1408 | break; | 1408 | break; |
| @@ -4982,32 +4982,31 @@ init_buffer (void) | |||
| 4982 | 4982 | ||
| 4983 | /* FIXME: use LISPSYM_INITIALLY instead of TAG_PTR_INITIALLY */ | 4983 | /* FIXME: use LISPSYM_INITIALLY instead of TAG_PTR_INITIALLY */ |
| 4984 | #define DEFVAR_PER_BUFFER(lname, vname, predicate_, doc) \ | 4984 | #define DEFVAR_PER_BUFFER(lname, vname, predicate_, doc) \ |
| 4985 | do \ | 4985 | do { \ |
| 4986 | { \ | 4986 | const Lisp_Object sym \ |
| 4987 | const Lisp_Object sym = TAG_PTR_INITIALLY ( \ | 4987 | = TAG_PTR_INITIALLY (Lisp_Symbol, (intptr_t)((i##predicate_) \ |
| 4988 | Lisp_Symbol, (intptr_t)((i##predicate_) * sizeof *lispsym)); \ | 4988 | * sizeof *lispsym)); \ |
| 4989 | static const struct Lisp_Fwd bo_fwd = { \ | 4989 | static const struct Lisp_Fwd bo_fwd \ |
| 4990 | .type = Lisp_Fwd_Buffer_Obj, \ | 4990 | = { .type = Lisp_Fwd_Buffer_Obj, \ |
| 4991 | .u.bufobjfwd = { .offset = offsetof (struct buffer, vname##_), \ | 4991 | .bufoffset = offsetof (struct buffer, vname##_), \ |
| 4992 | .predicate = sym }, \ | 4992 | .u.bufpredicate = sym }; \ |
| 4993 | }; \ | 4993 | static_assert (offsetof (struct buffer, vname##_) \ |
| 4994 | < (1 << 8 * sizeof bo_fwd.bufoffset)); \ | ||
| 4994 | defvar_per_buffer (&bo_fwd, lname); \ | 4995 | defvar_per_buffer (&bo_fwd, lname); \ |
| 4995 | } \ | 4996 | } while (0) |
| 4996 | while (0) | ||
| 4997 | 4997 | ||
| 4998 | static void | 4998 | static void |
| 4999 | defvar_per_buffer (const struct Lisp_Fwd *fwd, const char *namestring) | 4999 | defvar_per_buffer (const struct Lisp_Fwd *fwd, const char *namestring) |
| 5000 | { | 5000 | { |
| 5001 | eassert (fwd->type == Lisp_Fwd_Buffer_Obj); | 5001 | eassert (fwd->type == Lisp_Fwd_Buffer_Obj); |
| 5002 | const struct Lisp_Buffer_Objfwd *bo_fwd = XBUFFER_OBJFWD (fwd); | ||
| 5003 | struct Lisp_Symbol *sym = XSYMBOL (intern (namestring)); | 5002 | struct Lisp_Symbol *sym = XSYMBOL (intern (namestring)); |
| 5004 | 5003 | ||
| 5005 | sym->u.s.declared_special = true; | 5004 | sym->u.s.declared_special = true; |
| 5006 | sym->u.s.redirect = SYMBOL_FORWARDED; | 5005 | sym->u.s.redirect = SYMBOL_FORWARDED; |
| 5007 | SET_SYMBOL_FWD (sym, fwd); | 5006 | SET_SYMBOL_FWD (sym, fwd); |
| 5008 | XSETSYMBOL (PER_BUFFER_SYMBOL (bo_fwd->offset), sym); | 5007 | XSETSYMBOL (PER_BUFFER_SYMBOL (XBUFFER_OFFSET (fwd)), sym); |
| 5009 | 5008 | ||
| 5010 | if (PER_BUFFER_IDX (bo_fwd->offset) == 0) | 5009 | if (PER_BUFFER_IDX (XBUFFER_OFFSET (fwd)) == 0) |
| 5011 | /* Did a DEFVAR_PER_BUFFER without initializing the corresponding | 5010 | /* Did a DEFVAR_PER_BUFFER without initializing the corresponding |
| 5012 | slot of buffer_local_flags. */ | 5011 | slot of buffer_local_flags. */ |
| 5013 | emacs_abort (); | 5012 | emacs_abort (); |