changeset 4208:e820df1cb11a

[xemacs-hg @ 2007-10-03 13:28:19 by didierv] Assert correct order in face cache
author didierv
date Wed, 03 Oct 2007 13:28:21 +0000
parents 62d532188a28
children 3651e9c49476
files src/ChangeLog src/faces.c
diffstat 2 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Wed Oct 03 10:06:42 2007 +0000
+++ b/src/ChangeLog	Wed Oct 03 13:28:21 2007 +0000
@@ -1,3 +1,8 @@
+2007-10-03  Didier Verna  <didier@xemacs.org>
+
+	* faces.c (reset_face_cachels): Assert correct order of built-in
+	faces additions to the face cache, as per suggestion from Aidan.
+
 2007-10-03  Didier Verna  <didier@xemacs.org>
 
 	Again, fix some DEFAULT_INDEX == 0 assumptions. Actually, properly
--- a/src/faces.c	Wed Oct 03 10:06:42 2007 +0000
+++ b/src/faces.c	Wed Oct 03 13:28:21 2007 +0000
@@ -1584,6 +1584,7 @@
   if (w->face_cachels)
     {
       int i;
+      face_index fi;
 
       for (i = 0; i < Dynarr_length (w->face_cachels); i++)
 	{
@@ -1594,10 +1595,13 @@
       Dynarr_reset (w->face_cachels);
       /* #### NOTE: be careful with the order !
 	 The cpp macros DEFAULT_INDEX and MODELINE_INDEX defined in
-	 redisplay.h depend on the code below, which is really clumsy.
+	 redisplay.h depend on the code below. Please make sure to assert the
+	 correct values if you ever add new built-in faces here.
 	 -- dvl */
-      get_builtin_face_cache_index (w, Vdefault_face);
-      get_builtin_face_cache_index (w, Vmodeline_face);
+      fi = get_builtin_face_cache_index (w, Vdefault_face);
+      assert (fi == DEFAULT_INDEX);
+      fi = get_builtin_face_cache_index (w, Vmodeline_face);
+      assert (fi == MODELINE_INDEX);
       XFRAME (w->frame)->window_face_cache_reset = 1;
     }
 }