# HG changeset patch # User didierv # Date 1191418101 0 # Node ID e820df1cb11abb93ffe1ede8247e225823afb9bd # Parent 62d532188a285c58255b680853eaa3fbee653589 [xemacs-hg @ 2007-10-03 13:28:19 by didierv] Assert correct order in face cache diff -r 62d532188a28 -r e820df1cb11a src/ChangeLog --- 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 + + * 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 Again, fix some DEFAULT_INDEX == 0 assumptions. Actually, properly diff -r 62d532188a28 -r e820df1cb11a src/faces.c --- 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; } }