[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 9d8f900: Fix last change in xfaces.c
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] master 9d8f900: Fix last change in xfaces.c |
Date: |
Mon, 28 Jan 2019 15:04:42 -0500 (EST) |
branch: master
commit 9d8f900d93c196cd1048cdbad12e08da7a38a604
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>
Fix last change in xfaces.c
* src/xfaces.c (init_xfaces): Don't rely of 'face'
property of a face to be a natural number.
---
src/xfaces.c | 33 ++++++++++++---------------------
1 file changed, 12 insertions(+), 21 deletions(-)
diff --git a/src/xfaces.c b/src/xfaces.c
index 7facb13..3ba824b 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -6520,28 +6520,19 @@ init_xfaces (void)
{
if (CONSP (Vface_new_frame_defaults))
{
- Lisp_Object lface = XCAR (Vface_new_frame_defaults);
- if (CONSP (lface))
+ /* Allocate the lface_id_to_name[] array. */
+ lface_id_to_name_size = next_lface_id =
+ XFIXNAT (Flength (Vface_new_frame_defaults));
+ lface_id_to_name = xnmalloc (next_lface_id, sizeof *lface_id_to_name);
+
+ /* Store the faces. */
+ Lisp_Object tail;
+ int i = next_lface_id - 1;
+ for (tail = Vface_new_frame_defaults; CONSP (tail); tail = XCDR (tail))
{
- /* The first face in the list is the last face defined
- during loadup. Compute how many faces are there, and
- allocate the lface_id_to_name[] array. */
- Lisp_Object lface_id = Fget (XCAR (lface), Qface);
- lface_id_to_name_size = next_lface_id = XFIXNAT (lface_id) + 1;
- lface_id_to_name = xnmalloc (next_lface_id, sizeof *lface_id_to_name);
- /* Store the last face. */
- lface_id_to_name[next_lface_id - 1] = lface;
-
- /* Store the rest of the faces. */
- Lisp_Object tail;
- for (tail = XCDR (Vface_new_frame_defaults); CONSP (tail);
- tail = XCDR (tail))
- {
- lface = XCAR (tail);
- int face_id = XFIXNAT (Fget (XCAR (lface), Qface));
- eassert (face_id < lface_id_to_name_size);
- lface_id_to_name[face_id] = lface;
- }
+ Lisp_Object lface = XCAR (tail);
+ eassert (i >= 0);
+ lface_id_to_name[i--] = XCAR (lface);
}
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 9d8f900: Fix last change in xfaces.c,
Eli Zaretskii <=