aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier2006-10-03 13:47:26 +0000
committerStefan Monnier2006-10-03 13:47:26 +0000
commit54dd3310afa4bacd201ce9e126be49ede6aa3a36 (patch)
tree37a3e759f01471ae7529b6a88bad594d060f3ca8 /src
parentec40e71f22d2ccb626286622c5217ec282cf05c3 (diff)
downloademacs-54dd3310afa4bacd201ce9e126be49ede6aa3a36.tar.gz
emacs-54dd3310afa4bacd201ce9e126be49ede6aa3a36.zip
(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.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog14
-rw-r--r--src/search.c9
2 files changed, 21 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index b13d015c01a..f64020ca34d 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,17 @@
12006-10-03 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * lisp.h (clear_regexp_cache): Declare.
4
5 * search.c (compile_pattern): Only check `cp->syntax_table' if needed.
6 (compile_pattern_1): Remember `used_syntax' in `cp->syntax_table'.
7 (clear_regexp_cache): Only flush those regexps which depend on
8 a syntax-table.
9
10 * regex.c (regex_compile): Set the new `used_syntax' bit.
11
12 * regex.h: Remove file local variables.
13 (struct re_pattern_buffer): New field `used_syntax'.
14
12006-10-03 Kim F. Storm <storm@cua.dk> 152006-10-03 Kim F. Storm <storm@cua.dk>
2 16
3 * process.c (list_processes_1): Run sentinels before removing dead 17 * process.c (list_processes_1): Run sentinels before removing dead
diff --git a/src/search.c b/src/search.c
index 5f9f321067a..7c3151b76b8 100644
--- a/src/search.c
+++ b/src/search.c
@@ -216,7 +216,8 @@ shrink_regexp_cache ()
216 } 216 }
217} 217}
218 218
219/* Clear the regexp cache. 219/* Clear the regexp cache w.r.t. a particular syntax table,
220 because it was changed.
220 There is no danger of memory leak here because re_compile_pattern 221 There is no danger of memory leak here because re_compile_pattern
221 automagically manages the memory in each re_pattern_buffer struct, 222 automagically manages the memory in each re_pattern_buffer struct,
222 based on its `allocated' and `buffer' values. */ 223 based on its `allocated' and `buffer' values. */
@@ -226,7 +227,11 @@ clear_regexp_cache ()
226 int i; 227 int i;
227 228
228 for (i = 0; i < REGEXP_CACHE_SIZE; ++i) 229 for (i = 0; i < REGEXP_CACHE_SIZE; ++i)
229 searchbufs[i].regexp = Qnil; 230 /* It's tempting to compare with the syntax-table we've actually changd,
231 but it's not sufficient because char-table inheritance mewans that
232 modifying one syntax-table can change others at the same time. */
233 if (!EQ (searchbufs[i].syntax_table, Qt))
234 searchbufs[i].regexp = Qnil;
230} 235}
231 236
232/* Compile a regexp if necessary, but first check to see if there's one in 237/* Compile a regexp if necessary, but first check to see if there's one in