]> code.delx.au - gnu-emacs/commitdiff
(compile_pattern): Only check `cp->syntax_table' if needed.
authorStefan Monnier <monnier@iro.umontreal.ca>
Tue, 3 Oct 2006 13:47:26 +0000 (13:47 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Tue, 3 Oct 2006 13:47:26 +0000 (13:47 +0000)
(compile_pattern_1): Remember `used_syntax' in `cp->syntax_table'.
(clear_regexp_cache): Only flush those regexps which depend on
a syntax-table.

src/ChangeLog
src/search.c

index b13d015c01a0d4be6bd0316ba040e512ca7b141f..f64020ca34d39cc0d1646fab77c38c549a2d56d1 100644 (file)
@@ -1,3 +1,17 @@
+2006-10-03  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * lisp.h (clear_regexp_cache): Declare.
+
+       * search.c (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.
+
+       * regex.c (regex_compile): Set the new `used_syntax' bit.
+
+       * regex.h: Remove file local variables.
+       (struct re_pattern_buffer): New field `used_syntax'.
+
 2006-10-03  Kim F. Storm  <storm@cua.dk>
 
        * process.c (list_processes_1): Run sentinels before removing dead
index 5f9f321067a9fbceaca6e3a64e433ccfa7154ea2..7c3151b76b8475df0bd7c161be0542c9e767f35a 100644 (file)
@@ -216,7 +216,8 @@ shrink_regexp_cache ()
     }
 }
 
-/* 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 @@ clear_regexp_cache ()
   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