diff src/search.c @ 73232:5f8a28d018b2

(compile_pattern): Only check `cp->syntax_table' if needed. (compile_pattern_1): Remember `used_syntax' in `cp->syntax_table'. (clear_regexp_cache): Only flush those regexps which depend on a syntax-table.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 03 Oct 2006 13:47:26 +0000
parents 20801e603746
children 94626132135d 8dd8c8286063
line wrap: on
line diff
--- a/src/search.c	Tue Oct 03 13:38:18 2006 +0000
+++ b/src/search.c	Tue Oct 03 13:47:26 2006 +0000
@@ -216,7 +216,8 @@
     }
 }
 
-/* Clear the regexp cache.
+/* Clear the regexp cache w.r.t. a particular syntax table,
+   because it was changed.
    There is no danger of memory leak here because re_compile_pattern
    automagically manages the memory in each re_pattern_buffer struct,
    based on its `allocated' and `buffer' values.  */
@@ -226,7 +227,11 @@
   int i;
 
   for (i = 0; i < REGEXP_CACHE_SIZE; ++i)
-    searchbufs[i].regexp = Qnil;
+    /* It's tempting to compare with the syntax-table we've actually changd,
+       but it's not sufficient because char-table inheritance mewans that
+       modifying one syntax-table can change others at the same time.  */
+    if (!EQ (searchbufs[i].syntax_table, Qt))
+      searchbufs[i].regexp = Qnil;
 }
 
 /* Compile a regexp if necessary, but first check to see if there's one in