# HG changeset patch # User Chong Yidong # Date 1158514739 0 # Node ID d4ecc69b8d2e9bfc62840c30b5b6a68a02cfa1d2 # Parent 65c16038d6c97d7e67983ce3df0fb4f694c8f59f * search.c (clear_regexp_cache): New function. * syntax.c (Fmodify_syntax_entry): Clear regexp cache. diff -r 65c16038d6c9 -r d4ecc69b8d2e src/ChangeLog --- a/src/ChangeLog Sun Sep 17 15:31:54 2006 +0000 +++ b/src/ChangeLog Sun Sep 17 17:38:59 2006 +0000 @@ -1,3 +1,9 @@ +2006-09-17 Chong Yidong + + * search.c (clear_regexp_cache): New function. + + * syntax.c (Fmodify_syntax_entry): Clear regexp cache. + 2006-09-16 Jan Dj,Ad(Brv * gtkutil.c (xg_get_file_with_chooser): Check diff -r 65c16038d6c9 -r d4ecc69b8d2e src/search.c --- 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. diff -r 65c16038d6c9 -r d4ecc69b8d2e src/syntax.c --- a/src/syntax.c Sun Sep 17 15:31:54 2006 +0000 +++ b/src/syntax.c Sun Sep 17 17:38:59 2006 +0000 @@ -1039,6 +1039,11 @@ 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; }