Subject: bug#78813: closed (Re: bug#78813: feature/igc: [PATCH] Make the array face_attr_sym readonly)

From: [email-masked] (GNU bug Tracking System)
Date: Mon, 23 Jun 2025 11:16:04 +0000

Your bug report

#78813: feature/igc: [PATCH] Make the array face_attr_sym readonly

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
78813: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=78813
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#78813: feature/igc: [PATCH] Make the array face_attr_sym readonly
From: Eli Zaretskii <[email-masked]>
To: Helmut Eller <[email-masked]>
Cc: [email-masked], [email-masked]
Date: Mon, 23 Jun 2025 14:15:15 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

> From: Helmut Eller <[email-masked]>
> Cc: [email-masked],  [email-masked]
> Date: Sun, 22 Jun 2025 20:25:44 +0200
> 
> On Sat, Jun 21 2025, Eli Zaretskii wrote:
> 
> > Initialization using C initializers is used for simple values like
> > scalars.  The LISP_INITIALLY stuff should be used only very sparingly
> > and if strictly necessary, because it is very confusing at first
> > sight.  So I'd very much prefer that we kept the current conventions
> > for initializing complex variables, especially variables with Lisp
> > values.
> 
> This doesn't make much sense to me.  But your project, your rules.
> 
> So you can close this bug.

Done, thanks.

Subject: feature/igc: [PATCH] Make the array face_attr_sym readonly
From: Helmut Eller <[email-masked]>
To: [email-masked]
Date: Tue, 17 Jun 2025 10:49:10 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Tags: patch

This is a proposal to make the variable face_attr_sym const.  Mostly so
that it's more obvious that it doesn't need to be traced by the GC.

>From 264db35650707c60bbcc5b848a8ac461f56bf6b5 Mon Sep 17 00:00:00 2001
From: Helmut Eller <[email-masked]>
Date: Tue, 17 Jun 2025 09:38:05 +0200
Subject: [PATCH] Make the array face_attr_sym readonly

* src/xfaces.c (face_attr_sym): Make const and initialize.
(init_xfaces): Move initialization to declaration.
---
 src/xfaces.c | 42 +++++++++++++++++++++---------------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/src/xfaces.c b/src/xfaces.c
index 2ca68193876..ea8e97834dc 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -1813,7 +1813,27 @@ #define LFACEP(LFACE)					\

 /* Face attribute symbols for each value of LFACE_*_INDEX.  */
-static Lisp_Object face_attr_sym[LFACE_VECTOR_SIZE];
+static const Lisp_Object face_attr_sym[LFACE_VECTOR_SIZE] = {
+  [0] = LISPSYM_INITIALLY (Qface),
+  [LFACE_FOUNDRY_INDEX] = LISPSYM_INITIALLY (QCfoundry),
+  [LFACE_SWIDTH_INDEX] = LISPSYM_INITIALLY (QCwidth),
+  [LFACE_HEIGHT_INDEX] = LISPSYM_INITIALLY (QCheight),
+  [LFACE_WEIGHT_INDEX] = LISPSYM_INITIALLY (QCweight),
+  [LFACE_SLANT_INDEX] = LISPSYM_INITIALLY (QCslant),
+  [LFACE_UNDERLINE_INDEX] = LISPSYM_INITIALLY (QCunderline),
+  [LFACE_INVERSE_INDEX] = LISPSYM_INITIALLY (QCinverse_video),
+  [LFACE_FOREGROUND_INDEX] = LISPSYM_INITIALLY (QCforeground),
+  [LFACE_BACKGROUND_INDEX] = LISPSYM_INITIALLY (QCbackground),
+  [LFACE_STIPPLE_INDEX] = LISPSYM_INITIALLY (QCstipple),
+  [LFACE_OVERLINE_INDEX] = LISPSYM_INITIALLY (QCoverline),
+  [LFACE_STRIKE_THROUGH_INDEX] = LISPSYM_INITIALLY (QCstrike_through),
+  [LFACE_BOX_INDEX] = LISPSYM_INITIALLY (QCbox),
+  [LFACE_FONT_INDEX] = LISPSYM_INITIALLY (QCfont),
+  [LFACE_INHERIT_INDEX] = LISPSYM_INITIALLY (QCinherit),
+  [LFACE_FONTSET_INDEX] = LISPSYM_INITIALLY (QCfontset),
+  [LFACE_DISTANT_FOREGROUND_INDEX] = LISPSYM_INITIALLY (QCdistant_foreground),
+  [LFACE_EXTEND_INDEX] = LISPSYM_INITIALLY (QCextend),
+};
 
 #ifdef GLYPH_DEBUG
 
@@ -7382,26 +7402,6 @@ init_xfaces (void)
 	}
     }
 #endif
-
-  face_attr_sym[0] = Qface;
-  face_attr_sym[LFACE_FOUNDRY_INDEX] = QCfoundry;
-  face_attr_sym[LFACE_SWIDTH_INDEX] = QCwidth;
-  face_attr_sym[LFACE_HEIGHT_INDEX] = QCheight;
-  face_attr_sym[LFACE_WEIGHT_INDEX] = QCweight;
-  face_attr_sym[LFACE_SLANT_INDEX] = QCslant;
-  face_attr_sym[LFACE_UNDERLINE_INDEX] = QCunderline;
-  face_attr_sym[LFACE_INVERSE_INDEX] = QCinverse_video;
-  face_attr_sym[LFACE_FOREGROUND_INDEX] = QCforeground;
-  face_attr_sym[LFACE_BACKGROUND_INDEX] = QCbackground;
-  face_attr_sym[LFACE_STIPPLE_INDEX] = QCstipple;
-  face_attr_sym[LFACE_OVERLINE_INDEX] = QCoverline;
-  face_attr_sym[LFACE_STRIKE_THROUGH_INDEX] = QCstrike_through;
-  face_attr_sym[LFACE_BOX_INDEX] = QCbox;
-  face_attr_sym[LFACE_FONT_INDEX] = QCfont;
-  face_attr_sym[LFACE_INHERIT_INDEX] = QCinherit;
-  face_attr_sym[LFACE_FONTSET_INDEX] = QCfontset;
-  face_attr_sym[LFACE_DISTANT_FOREGROUND_INDEX] = QCdistant_foreground;
-  face_attr_sym[LFACE_EXTEND_INDEX] = QCextend;
 }
 
 void
-- 
2.39.5