aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/xfaces.c33
1 files changed, 12 insertions, 21 deletions
diff --git a/src/xfaces.c b/src/xfaces.c
index 7facb13b76c..3ba824b6517 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -6520,28 +6520,19 @@ init_xfaces (void)
6520{ 6520{
6521 if (CONSP (Vface_new_frame_defaults)) 6521 if (CONSP (Vface_new_frame_defaults))
6522 { 6522 {
6523 Lisp_Object lface = XCAR (Vface_new_frame_defaults); 6523 /* Allocate the lface_id_to_name[] array. */
6524 if (CONSP (lface)) 6524 lface_id_to_name_size = next_lface_id =
6525 XFIXNAT (Flength (Vface_new_frame_defaults));
6526 lface_id_to_name = xnmalloc (next_lface_id, sizeof *lface_id_to_name);
6527
6528 /* Store the faces. */
6529 Lisp_Object tail;
6530 int i = next_lface_id - 1;
6531 for (tail = Vface_new_frame_defaults; CONSP (tail); tail = XCDR (tail))
6525 { 6532 {
6526 /* The first face in the list is the last face defined 6533 Lisp_Object lface = XCAR (tail);
6527 during loadup. Compute how many faces are there, and 6534 eassert (i >= 0);
6528 allocate the lface_id_to_name[] array. */ 6535 lface_id_to_name[i--] = XCAR (lface);
6529 Lisp_Object lface_id = Fget (XCAR (lface), Qface);
6530 lface_id_to_name_size = next_lface_id = XFIXNAT (lface_id) + 1;
6531 lface_id_to_name = xnmalloc (next_lface_id, sizeof *lface_id_to_name);
6532 /* Store the last face. */
6533 lface_id_to_name[next_lface_id - 1] = lface;
6534
6535 /* Store the rest of the faces. */
6536 Lisp_Object tail;
6537 for (tail = XCDR (Vface_new_frame_defaults); CONSP (tail);
6538 tail = XCDR (tail))
6539 {
6540 lface = XCAR (tail);
6541 int face_id = XFIXNAT (Fget (XCAR (lface), Qface));
6542 eassert (face_id < lface_id_to_name_size);
6543 lface_id_to_name[face_id] = lface;
6544 }
6545 } 6536 }
6546 } 6537 }
6547} 6538}