diff options
| author | Richard M. Stallman | 1996-09-22 04:38:10 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-09-22 04:38:10 +0000 |
| commit | 1d288aefee1f72d5a0b56d90eca25aef7f32014f (patch) | |
| tree | 8a47a4c90877ca75608cb918269460144be5c2b4 /src/search.c | |
| parent | f3e472b0b76a351beec4f6447f17a567103026f0 (diff) | |
| download | emacs-1d288aefee1f72d5a0b56d90eca25aef7f32014f.tar.gz emacs-1d288aefee1f72d5a0b56d90eca25aef7f32014f.zip | |
(REGEXP_CACHE_SIZE): Increase to 20.
(compile_pattern): Check for size match before calling Fstring_equal.
Diffstat (limited to 'src/search.c')
| -rw-r--r-- | src/search.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/search.c b/src/search.c index 6f4355f5b88..5713e53fd90 100644 --- a/src/search.c +++ b/src/search.c | |||
| @@ -30,11 +30,12 @@ Boston, MA 02111-1307, USA. */ | |||
| 30 | #include <sys/types.h> | 30 | #include <sys/types.h> |
| 31 | #include "regex.h" | 31 | #include "regex.h" |
| 32 | 32 | ||
| 33 | #define REGEXP_CACHE_SIZE 5 | 33 | #define REGEXP_CACHE_SIZE 20 |
| 34 | 34 | ||
| 35 | /* If the regexp is non-nil, then the buffer contains the compiled form | 35 | /* If the regexp is non-nil, then the buffer contains the compiled form |
| 36 | of that regexp, suitable for searching. */ | 36 | of that regexp, suitable for searching. */ |
| 37 | struct regexp_cache { | 37 | struct regexp_cache |
| 38 | { | ||
| 38 | struct regexp_cache *next; | 39 | struct regexp_cache *next; |
| 39 | Lisp_Object regexp; | 40 | Lisp_Object regexp; |
| 40 | struct re_pattern_buffer buf; | 41 | struct re_pattern_buffer buf; |
| @@ -156,7 +157,8 @@ compile_pattern (pattern, regp, translate, posix) | |||
| 156 | for (cpp = &searchbuf_head; ; cpp = &cp->next) | 157 | for (cpp = &searchbuf_head; ; cpp = &cp->next) |
| 157 | { | 158 | { |
| 158 | cp = *cpp; | 159 | cp = *cpp; |
| 159 | if (!NILP (Fstring_equal (cp->regexp, pattern)) | 160 | if (XSTRING (cp->regexp)->size == XSTRING (pattern)->size |
| 161 | && !NILP (Fstring_equal (cp->regexp, pattern)) | ||
| 160 | && cp->buf.translate == translate | 162 | && cp->buf.translate == translate |
| 161 | && cp->posix == posix) | 163 | && cp->posix == posix) |
| 162 | break; | 164 | break; |