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.
This commit is contained in:
Helmut Eller 2024-06-23 11:25:35 +02:00
parent 10befec978
commit 6d9ba8e7bf
3 changed files with 13 additions and 23 deletions

View file

@ -65,11 +65,11 @@ XKBOARD_OBJFWD (lispfwd a)
eassert (KBOARD_OBJFWDP (a));
return &a->u.kboardobjfwd;
}
static struct Lisp_Intfwd const *
XFIXNUMFWD (lispfwd a)
static intmax_t *
XINTVAR (lispfwd a)
{
eassert (INTFWDP (a));
return &a->u.intfwd;
return a->u.intvar;
}
static struct Lisp_Objfwd const *
XOBJFWD (lispfwd a)
@ -1332,7 +1332,7 @@ do_symval_forwarding (lispfwd valcontents)
switch (XFWDTYPE (valcontents))
{
case Lisp_Fwd_Int:
return make_int (*XFIXNUMFWD (valcontents)->intvar);
return make_int (*XINTVAR (valcontents));
case Lisp_Fwd_Bool:
return (*XBOOLFWD (valcontents)->boolvar ? Qt : Qnil);
@ -1418,7 +1418,7 @@ store_symval_forwarding (lispfwd valcontents, Lisp_Object newval,
CHECK_INTEGER (newval);
if (! integer_to_intmax (newval, &i))
xsignal1 (Qoverflow_error, newval);
*XFIXNUMFWD (valcontents)->intvar = i;
*XINTVAR (valcontents) = i;
}
break;

View file

@ -3053,15 +3053,6 @@ make_uint (uintmax_t n)
(EXPR_SIGNED (expr) ? make_int (expr) : make_uint (expr))
/* Forwarding pointer to an int variable.
This is allowed only in the value cell of a symbol,
and it means that the symbol's value really lives in the
specified int variable. */
struct Lisp_Intfwd
{
intmax_t *intvar;
};
/* Boolean forwarding pointer to an int variable.
This is like Lisp_Intfwd except that the ostensible
"value" of the symbol is t if the bool variable is true,
@ -3144,7 +3135,7 @@ struct Lisp_Fwd
enum Lisp_Fwd_Type type;
union
{
struct Lisp_Intfwd intfwd;
intmax_t *intvar;
struct Lisp_Boolfwd boolfwd;
struct Lisp_Objfwd objfwd;
struct Lisp_Buffer_Objfwd bufobjfwd;
@ -3533,10 +3524,9 @@ extern void defvar_kboard (struct Lisp_Fwd const *, char const *);
#define DEFVAR_INT(lname, vname, doc) \
do { \
static struct Lisp_Fwd const i_fwd \
= {Lisp_Fwd_Int, .u.intfwd = {&globals.f_##vname}}; \
= {Lisp_Fwd_Int, .u.intvar = &globals.f_##vname}; \
defvar_int (&i_fwd, lname); \
} while (false)
#define DEFVAR_KBOARD(lname, vname, doc) \
do \
{ \

View file

@ -2309,8 +2309,8 @@ dump_field_fwd (struct dump_context *ctx, void *out, const void *in_start,
{
case Lisp_Fwd_Int:
{
const struct Lisp_Intfwd *fwd = &(*in_field)->u.intfwd;
dump_emacs_reloc_immediate_intmax_t (ctx, fwd->intvar, *fwd->intvar);
const intmax_t *intvar = (*in_field)->u.intvar;
dump_emacs_reloc_immediate_intmax_t (ctx, intvar, *intvar);
}
return;
case Lisp_Fwd_Bool: