aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHelmut Eller2024-06-23 15:34:55 +0200
committerHelmut Eller2026-02-12 18:51:51 +0100
commitd109bcf86e870d003b45930c82f8140e8ba415ac (patch)
treef7c924c4a3527ffc6df3f7b7e6fe9ec971968563 /src
parent9d9189f74c5bd23b249833d70c4390cdbf16fc68 (diff)
downloademacs-d109bcf86e870d003b45930c82f8140e8ba415ac.tar.gz
emacs-d109bcf86e870d003b45930c82f8140e8ba415ac.zip
Remove struct Lisp_Objfwd
* src/lisp.h (struct Lisp_Objfwd): Deleted. (struct Lisp_Fwd): Replace it with objvar field. (DEFVAR_LISP, DEFVAR_LISP_NOPRO, DEFVAR_LISP_NOPROX): Use the field. * src/lread.c (defvar_lisp): Updated as needed. * src/pdumper.c (dump_field_fwd): Use the field. * src/data.c (XOBJVAR): Renamed and updated from XOBJFWD. (do_symval_forwarding, store_symval_forwarding): Use it.
Diffstat (limited to 'src')
-rw-r--r--src/data.c16
-rw-r--r--src/lisp.h25
-rw-r--r--src/lread.c2
-rw-r--r--src/pdumper.c6
4 files changed, 20 insertions, 29 deletions
diff --git a/src/data.c b/src/data.c
index e33f4c92d35..337d640b2b5 100644
--- a/src/data.c
+++ b/src/data.c
@@ -71,11 +71,11 @@ XINTVAR (lispfwd a)
71 eassert (INTFWDP (a)); 71 eassert (INTFWDP (a));
72 return a->u.intvar; 72 return a->u.intvar;
73} 73}
74static struct Lisp_Objfwd const * 74static Lisp_Object *
75XOBJFWD (lispfwd a) 75XOBJVAR (lispfwd a)
76{ 76{
77 eassert (OBJFWDP (a)); 77 eassert (OBJFWDP (a));
78 return &a->u.objfwd; 78 return a->u.objvar;
79} 79}
80 80
81static void 81static void
@@ -1338,7 +1338,7 @@ do_symval_forwarding (lispfwd valcontents)
1338 return (*XBOOLVAR (valcontents) ? Qt : Qnil); 1338 return (*XBOOLVAR (valcontents) ? Qt : Qnil);
1339 1339
1340 case Lisp_Fwd_Obj: 1340 case Lisp_Fwd_Obj:
1341 return *XOBJFWD (valcontents)->objvar; 1341 return *XOBJVAR (valcontents);
1342 1342
1343 case Lisp_Fwd_Buffer_Obj: 1343 case Lisp_Fwd_Buffer_Obj:
1344 return per_buffer_value (current_buffer, 1344 return per_buffer_value (current_buffer,
@@ -1427,16 +1427,16 @@ store_symval_forwarding (lispfwd valcontents, Lisp_Object newval,
1427 break; 1427 break;
1428 1428
1429 case Lisp_Fwd_Obj: 1429 case Lisp_Fwd_Obj:
1430 *XOBJFWD (valcontents)->objvar = newval; 1430 *XOBJVAR (valcontents) = newval;
1431 1431
1432 /* If this variable is a default for something stored 1432 /* If this variable is a default for something stored
1433 in the buffer itself, such as default-fill-column, 1433 in the buffer itself, such as default-fill-column,
1434 find the buffers that don't have local values for it 1434 find the buffers that don't have local values for it
1435 and update them. */ 1435 and update them. */
1436 if (XOBJFWD (valcontents)->objvar > (Lisp_Object *) &buffer_defaults 1436 if (XOBJVAR (valcontents) > (Lisp_Object *) &buffer_defaults
1437 && XOBJFWD (valcontents)->objvar < (Lisp_Object *) (&buffer_defaults + 1)) 1437 && XOBJVAR (valcontents) < (Lisp_Object *) (&buffer_defaults + 1))
1438 { 1438 {
1439 int offset = ((char *) XOBJFWD (valcontents)->objvar 1439 int offset = ((char *) XOBJVAR (valcontents)
1440 - (char *) &buffer_defaults); 1440 - (char *) &buffer_defaults);
1441 int idx = PER_BUFFER_IDX (offset); 1441 int idx = PER_BUFFER_IDX (offset);
1442 1442
diff --git a/src/lisp.h b/src/lisp.h
index 24bd20d1562..40556527d3a 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3053,15 +3053,6 @@ make_uint (uintmax_t n)
3053 (EXPR_SIGNED (expr) ? make_int (expr) : make_uint (expr)) 3053 (EXPR_SIGNED (expr) ? make_int (expr) : make_uint (expr))
3054 3054
3055 3055
3056/* Forwarding pointer to a Lisp_Object variable.
3057 This is allowed only in the value cell of a symbol,
3058 and it means that the symbol's value really lives in the
3059 specified variable. */
3060struct Lisp_Objfwd
3061 {
3062 Lisp_Object *objvar;
3063 };
3064
3065/* Like Lisp_Objfwd except that value lives in a slot in the 3056/* Like Lisp_Objfwd except that value lives in a slot in the
3066 current buffer. Value is byte index of slot within buffer. */ 3057 current buffer. Value is byte index of slot within buffer. */
3067struct Lisp_Buffer_Objfwd 3058struct Lisp_Buffer_Objfwd
@@ -3128,7 +3119,7 @@ struct Lisp_Fwd
3128 { 3119 {
3129 intmax_t *intvar; 3120 intmax_t *intvar;
3130 bool *boolvar; 3121 bool *boolvar;
3131 struct Lisp_Objfwd objfwd; 3122 Lisp_Object *objvar;
3132 struct Lisp_Buffer_Objfwd bufobjfwd; 3123 struct Lisp_Buffer_Objfwd bufobjfwd;
3133 struct Lisp_Kboard_Objfwd kboardobjfwd; 3124 struct Lisp_Kboard_Objfwd kboardobjfwd;
3134 } u; 3125 } u;
@@ -3494,16 +3485,16 @@ extern void defvar_kboard (struct Lisp_Fwd const *, char const *);
3494 All C code uses the `cons_cells_consed' name. This is all done 3485 All C code uses the `cons_cells_consed' name. This is all done
3495 this way to support indirection for multi-threaded Emacs. */ 3486 this way to support indirection for multi-threaded Emacs. */
3496 3487
3497#define DEFVAR_LISP(lname, vname, doc) \ 3488#define DEFVAR_LISP(lname, vname, doc) \
3498 do { \ 3489 do { \
3499 static struct Lisp_Fwd const o_fwd \ 3490 static struct Lisp_Fwd const o_fwd \
3500 = {Lisp_Fwd_Obj, .u.objfwd = {&globals.f_##vname}}; \ 3491 = {Lisp_Fwd_Obj, .u.objvar = &globals.f_##vname}; \
3501 defvar_lisp (&o_fwd, lname); \ 3492 defvar_lisp (&o_fwd, lname); \
3502 } while (false) 3493 } while (false)
3503#define DEFVAR_LISP_NOPRO(lname, vname, doc) \ 3494#define DEFVAR_LISP_NOPRO(lname, vname, doc) \
3504 do { \ 3495 do { \
3505 static struct Lisp_Fwd const o_fwd \ 3496 static struct Lisp_Fwd const o_fwd \
3506 = {Lisp_Fwd_Obj, .u.objfwd = {&globals.f_##vname}}; \ 3497 = {Lisp_Fwd_Obj, .u.objvar = &globals.f_##vname}; \
3507 defvar_lisp_nopro (&o_fwd, lname); \ 3498 defvar_lisp_nopro (&o_fwd, lname); \
3508 } while (false) 3499 } while (false)
3509#define DEFVAR_BOOL(lname, vname, doc) \ 3500#define DEFVAR_BOOL(lname, vname, doc) \
diff --git a/src/lread.c b/src/lread.c
index f8c41bd80b8..9d91ac8909d 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -5282,7 +5282,7 @@ defvar_lisp (struct Lisp_Fwd const *o_fwd, char const *namestring)
5282{ 5282{
5283 eassert (o_fwd->type == Lisp_Fwd_Obj); 5283 eassert (o_fwd->type == Lisp_Fwd_Obj);
5284 defvar_lisp_nopro (o_fwd, namestring); 5284 defvar_lisp_nopro (o_fwd, namestring);
5285 staticpro (o_fwd->u.objfwd.objvar); 5285 staticpro (o_fwd->u.objvar);
5286} 5286}
5287 5287
5288/* Similar but define a variable whose value is the Lisp Object stored 5288/* Similar but define a variable whose value is the Lisp Object stored
diff --git a/src/pdumper.c b/src/pdumper.c
index d23eaa82696..c21af24d9f1 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -2321,10 +2321,10 @@ dump_field_fwd (struct dump_context *ctx, void *out, const void *in_start,
2321 return; 2321 return;
2322 case Lisp_Fwd_Obj: 2322 case Lisp_Fwd_Obj:
2323 { 2323 {
2324 const struct Lisp_Objfwd *fwd = &(*in_field)->u.objfwd; 2324 const Lisp_Object *objvar = (*in_field)->u.objvar;
2325 if (NILP (Fgethash (dump_off_to_lisp (emacs_offset (fwd->objvar)), 2325 if (NILP (Fgethash (dump_off_to_lisp (emacs_offset (objvar)),
2326 ctx->staticpro_table, Qnil))) 2326 ctx->staticpro_table, Qnil)))
2327 dump_emacs_reloc_to_lv (ctx, fwd->objvar, *fwd->objvar); 2327 dump_emacs_reloc_to_lv (ctx, objvar, *objvar);
2328 } 2328 }
2329 return; 2329 return;
2330 case Lisp_Fwd_Kboard_Obj: 2330 case Lisp_Fwd_Kboard_Obj: