aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHelmut Eller2024-06-23 11:25:35 +0200
committerHelmut Eller2026-02-12 18:51:51 +0100
commit6d9ba8e7bf045155bdd6dfbf8126fe866fd3e3aa (patch)
treea9efcdcefb7a8167b58c6e2e76a5784db4143a24 /src
parent10befec978d1f1490f1eb43fd590e9474252063f (diff)
downloademacs-6d9ba8e7bf045155bdd6dfbf8126fe866fd3e3aa.tar.gz
emacs-6d9ba8e7bf045155bdd6dfbf8126fe866fd3e3aa.zip
Remove struct Lisp_Intfwd
It was a struct with a single field. * src/lisp.h (struct Lisp_Intfwd): Deleted. (struct Lisp_Fwd): Add an intvar field instead. (DEFVAR_INT): Update accordingly. * src/data.c (XINTVAR): Updated and renamed from XFIXNUMFWD. (do_symval_forwarding, store_symval_forwarding): Use it.
Diffstat (limited to 'src')
-rw-r--r--src/data.c10
-rw-r--r--src/lisp.h22
-rw-r--r--src/pdumper.c4
3 files changed, 13 insertions, 23 deletions
diff --git a/src/data.c b/src/data.c
index 952c686a466..4334c8dabcb 100644
--- a/src/data.c
+++ b/src/data.c
@@ -65,11 +65,11 @@ XKBOARD_OBJFWD (lispfwd a)
65 eassert (KBOARD_OBJFWDP (a)); 65 eassert (KBOARD_OBJFWDP (a));
66 return &a->u.kboardobjfwd; 66 return &a->u.kboardobjfwd;
67} 67}
68static struct Lisp_Intfwd const * 68static intmax_t *
69XFIXNUMFWD (lispfwd a) 69XINTVAR (lispfwd a)
70{ 70{
71 eassert (INTFWDP (a)); 71 eassert (INTFWDP (a));
72 return &a->u.intfwd; 72 return a->u.intvar;
73} 73}
74static struct Lisp_Objfwd const * 74static struct Lisp_Objfwd const *
75XOBJFWD (lispfwd a) 75XOBJFWD (lispfwd a)
@@ -1332,7 +1332,7 @@ do_symval_forwarding (lispfwd valcontents)
1332 switch (XFWDTYPE (valcontents)) 1332 switch (XFWDTYPE (valcontents))
1333 { 1333 {
1334 case Lisp_Fwd_Int: 1334 case Lisp_Fwd_Int:
1335 return make_int (*XFIXNUMFWD (valcontents)->intvar); 1335 return make_int (*XINTVAR (valcontents));
1336 1336
1337 case Lisp_Fwd_Bool: 1337 case Lisp_Fwd_Bool:
1338 return (*XBOOLFWD (valcontents)->boolvar ? Qt : Qnil); 1338 return (*XBOOLFWD (valcontents)->boolvar ? Qt : Qnil);
@@ -1418,7 +1418,7 @@ store_symval_forwarding (lispfwd valcontents, Lisp_Object newval,
1418 CHECK_INTEGER (newval); 1418 CHECK_INTEGER (newval);
1419 if (! integer_to_intmax (newval, &i)) 1419 if (! integer_to_intmax (newval, &i))
1420 xsignal1 (Qoverflow_error, newval); 1420 xsignal1 (Qoverflow_error, newval);
1421 *XFIXNUMFWD (valcontents)->intvar = i; 1421 *XINTVAR (valcontents) = i;
1422 } 1422 }
1423 break; 1423 break;
1424 1424
diff --git a/src/lisp.h b/src/lisp.h
index 6cb05141ea4..d35450df5fd 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 an int 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 int variable. */
3060struct Lisp_Intfwd
3061 {
3062 intmax_t *intvar;
3063 };
3064
3065/* Boolean forwarding pointer to an int variable. 3056/* Boolean forwarding pointer to an int variable.
3066 This is like Lisp_Intfwd except that the ostensible 3057 This is like Lisp_Intfwd except that the ostensible
3067 "value" of the symbol is t if the bool variable is true, 3058 "value" of the symbol is t if the bool variable is true,
@@ -3144,7 +3135,7 @@ struct Lisp_Fwd
3144 enum Lisp_Fwd_Type type; 3135 enum Lisp_Fwd_Type type;
3145 union 3136 union
3146 { 3137 {
3147 struct Lisp_Intfwd intfwd; 3138 intmax_t *intvar;
3148 struct Lisp_Boolfwd boolfwd; 3139 struct Lisp_Boolfwd boolfwd;
3149 struct Lisp_Objfwd objfwd; 3140 struct Lisp_Objfwd objfwd;
3150 struct Lisp_Buffer_Objfwd bufobjfwd; 3141 struct Lisp_Buffer_Objfwd bufobjfwd;
@@ -3530,13 +3521,12 @@ extern void defvar_kboard (struct Lisp_Fwd const *, char const *);
3530 = {Lisp_Fwd_Bool, .u.boolfwd = {&globals.f_##vname}}; \ 3521 = {Lisp_Fwd_Bool, .u.boolfwd = {&globals.f_##vname}}; \
3531 defvar_bool (&b_fwd, lname); \ 3522 defvar_bool (&b_fwd, lname); \
3532 } while (false) 3523 } while (false)
3533#define DEFVAR_INT(lname, vname, doc) \ 3524#define DEFVAR_INT(lname, vname, doc) \
3534 do { \ 3525 do { \
3535 static struct Lisp_Fwd const i_fwd \ 3526 static struct Lisp_Fwd const i_fwd \
3536 = {Lisp_Fwd_Int, .u.intfwd = {&globals.f_##vname}}; \ 3527 = {Lisp_Fwd_Int, .u.intvar = &globals.f_##vname}; \
3537 defvar_int (&i_fwd, lname); \ 3528 defvar_int (&i_fwd, lname); \
3538 } while (false) 3529 } while (false)
3539
3540#define DEFVAR_KBOARD(lname, vname, doc) \ 3530#define DEFVAR_KBOARD(lname, vname, doc) \
3541do \ 3531do \
3542 { \ 3532 { \
diff --git a/src/pdumper.c b/src/pdumper.c
index 45da1074006..bd1e5655f81 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -2309,8 +2309,8 @@ dump_field_fwd (struct dump_context *ctx, void *out, const void *in_start,
2309 { 2309 {
2310 case Lisp_Fwd_Int: 2310 case Lisp_Fwd_Int:
2311 { 2311 {
2312 const struct Lisp_Intfwd *fwd = &(*in_field)->u.intfwd; 2312 const intmax_t *intvar = (*in_field)->u.intvar;
2313 dump_emacs_reloc_immediate_intmax_t (ctx, fwd->intvar, *fwd->intvar); 2313 dump_emacs_reloc_immediate_intmax_t (ctx, intvar, *intvar);
2314 } 2314 }
2315 return; 2315 return;
2316 case Lisp_Fwd_Bool: 2316 case Lisp_Fwd_Bool: