diff src/search.c @ 72945:d4ecc69b8d2e

* search.c (clear_regexp_cache): New function. * syntax.c (Fmodify_syntax_entry): Clear regexp cache.
author Chong Yidong <cyd@stupidchicken.com>
date Sun, 17 Sep 2006 17:38:59 +0000
parents ef0421dfce16
children b3a72607819d
line wrap: on
line diff
--- a/src/search.c	Sun Sep 17 15:31:54 2006 +0000
+++ b/src/search.c	Sun Sep 17 17:38:59 2006 +0000
@@ -207,6 +207,19 @@
     }
 }
 
+/* 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.