]> code.delx.au - gnu-emacs/commitdiff
* search.c (clear_regexp_cache): New function.
authorChong Yidong <cyd@stupidchicken.com>
Sun, 17 Sep 2006 17:38:59 +0000 (17:38 +0000)
committerChong Yidong <cyd@stupidchicken.com>
Sun, 17 Sep 2006 17:38:59 +0000 (17:38 +0000)
* syntax.c (Fmodify_syntax_entry): Clear regexp cache.

src/ChangeLog
src/search.c
src/syntax.c

index 9b74ac1ed89a9d8af07f979c448ffbcbaa2821dd..a205a9cc6c3e85af46f87046544e66e83d76ea2c 100644 (file)
@@ -1,3 +1,9 @@
+2006-09-17  Chong Yidong  <cyd@stupidchicken.com>
+
+       * search.c (clear_regexp_cache): New function.
+
+       * syntax.c (Fmodify_syntax_entry): Clear regexp cache.
+
 2006-09-16  Jan Dj\e,Ad\e(Brv  <jan.h.d@swipnet.se>
 
        * gtkutil.c (xg_get_file_with_chooser): Check
index 2063e7d95ba85474a5d5f22a2542b979992fee4f..8b469a37b7001c1633bf0e939e7080458655f044 100644 (file)
@@ -207,6 +207,19 @@ shrink_regexp_cache ()
     }
 }
 
+/* Clear the regexp cache.
+   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.  */
+void
+clear_regexp_cache ()
+{
+  int i;
+
+  for (i = 0; i < REGEXP_CACHE_SIZE; ++i)
+    searchbufs[i].regexp = Qnil;
+}
+
 /* Compile a regexp if necessary, but first check to see if there's one in
    the cache.
    PATTERN is the pattern to compile.
index eee9151f87867519866d6f673a9eaae990d735e2..052191d5fef8f670f5306178551fddaef5bdb053 100644 (file)
@@ -1039,6 +1039,11 @@ usage: (modify-syntax-entry CHAR NEWENTRY &optional SYNTAX-TABLE) */)
     check_syntax_table (syntax_table);
 
   SET_RAW_SYNTAX_ENTRY (syntax_table, XINT (c), Fstring_to_syntax (newentry));
+
+  /* We clear the regexp cache, since character classes can now have
+     different values from those in the compiled regexps.*/
+  clear_regexp_cache ();
+
   return Qnil;
 }
 \f