From 26b43b4b58e62ab2c6c0ce438d9b17a2abce0ef9 Mon Sep 17 00:00:00 2001 From: Helmut Eller Date: Sun, 23 Jun 2024 11:37:58 +0200 Subject: [PATCH 3/6] Remove struct Lisp_Boolfwd * src/lisp.h (struct Lisp Boolfwd): Deleted (struct Lisp_Fwd): Replaced it with a boolvar field. (DEFVAR_BOOL): Update. * src/data.c (XBOOLVAR): Renamed from XBOOLFWD. (do_symval_forwarding, store_symval_forwarding): Use it. * src/pdumper.c (dump_field_fwd): Use boolvar field. --- src/data.c | 10 +++++----- src/lisp.h | 13 ++----------- src/pdumper.c | 4 ++-- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/data.c b/src/data.c index 9b3984d80e6..292a2f2cf06 100644 --- a/src/data.c +++ b/src/data.c @@ -55,11 +55,11 @@ OBJFWDP (lispfwd a) return XFWDTYPE (a) == Lisp_Fwd_Obj; } -static struct Lisp_Boolfwd const * -XBOOLFWD (lispfwd a) +static bool * +XBOOLVAR (lispfwd a) { eassert (BOOLFWDP (a)); - return &a->u.boolfwd; + return a->u.boolvar; } static struct Lisp_Kboard_Objfwd const * XKBOARD_OBJFWD (lispfwd a) @@ -1336,7 +1336,7 @@ do_symval_forwarding (lispfwd valcontents) return make_int (*XINTVAR (valcontents)); case Lisp_Fwd_Bool: - return (*XBOOLFWD (valcontents)->boolvar ? Qt : Qnil); + return (*XBOOLVAR (valcontents) ? Qt : Qnil); case Lisp_Fwd_Obj: return *XOBJFWD (valcontents)->objvar; @@ -1424,7 +1424,7 @@ store_symval_forwarding (lispfwd valcontents, Lisp_Object newval, break; case Lisp_Fwd_Bool: - *XBOOLFWD (valcontents)->boolvar = !NILP (newval); + *XBOOLVAR (valcontents) = !NILP (newval); break; case Lisp_Fwd_Obj: diff --git a/src/lisp.h b/src/lisp.h index bfbf2447635..a31079ad4bd 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -3115,15 +3115,6 @@ #define INT_TO_INTEGER(expr) \ (EXPR_SIGNED (expr) ? make_int (expr) : make_uint (expr)) -/* 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, - nil if it is false. */ -struct Lisp_Boolfwd - { - bool *boolvar; - }; - /* Forwarding pointer to a Lisp_Object variable. This is allowed only in the value cell of a symbol, and it means that the symbol's value really lives in the @@ -3198,7 +3189,7 @@ #define INT_TO_INTEGER(expr) \ union { intmax_t *intvar; - struct Lisp_Boolfwd boolfwd; + bool *boolvar; struct Lisp_Objfwd objfwd; struct Lisp_Buffer_Objfwd bufobjfwd; struct Lisp_Kboard_Objfwd kboardobjfwd; @@ -3616,7 +3607,7 @@ #define DEFVAR_LISP_NOPROX(lname, vname, doc) \ #define DEFVAR_BOOL(lname, vname, doc) \ do { \ static struct Lisp_Fwd const b_fwd \ - = {Lisp_Fwd_Bool, .u.boolfwd = {&globals.f_##vname}}; \ + = {Lisp_Fwd_Bool, .u.boolvar = &globals.f_##vname}; \ defvar_bool (&b_fwd, lname); \ } while (false) #define DEFVAR_INT(lname, vname, doc) \ diff --git a/src/pdumper.c b/src/pdumper.c index 84175ea9a2c..7bb7ecc7a07 100644 --- a/src/pdumper.c +++ b/src/pdumper.c @@ -2373,8 +2373,8 @@ dump_field_fwd (struct dump_context *ctx, void *out, const void *in_start, return; case Lisp_Fwd_Bool: { - const struct Lisp_Boolfwd *fwd = &(*in_field)->u.boolfwd; - dump_emacs_reloc_immediate_bool (ctx, fwd->boolvar, *fwd->boolvar); + const bool *boolvar = (*in_field)->u.boolvar; + dump_emacs_reloc_immediate_bool (ctx, boolvar, *boolvar); } return; case Lisp_Fwd_Obj: -- 2.39.2