diff options
| author | Ken Raeburn | 2000-02-03 07:54:12 +0000 |
|---|---|---|
| committer | Ken Raeburn | 2000-02-03 07:54:12 +0000 |
| commit | f1b9c7c1ce775f54c5a32c9c80c09584ccb3d7ca (patch) | |
| tree | d8fab032568b1b25e8ab7d7c4075bd1ef90b222e /src | |
| parent | 15c9cf819332f019605e073584a93f2b9b8dc124 (diff) | |
| download | emacs-f1b9c7c1ce775f54c5a32c9c80c09584ccb3d7ca.tar.gz emacs-f1b9c7c1ce775f54c5a32c9c80c09584ccb3d7ca.zip | |
* search.c (compile_pattern): If a cache entry has a nil regexp, fill in that
entry instead of clobbering a previously cached string regexp.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/search.c | 12 |
2 files changed, 17 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index f3b41fcf188..5251578b710 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2000-02-03 Ken Raeburn <raeburn@raeburn.org> | ||
| 2 | |||
| 3 | * search.c (compile_pattern): If a cache entry has a nil regexp, | ||
| 4 | fill in that entry instead of clobbering a previously cached | ||
| 5 | string regexp. | ||
| 6 | |||
| 1 | 2000-02-02 Ken Raeburn <raeburn@raeburn.org> | 7 | 2000-02-02 Ken Raeburn <raeburn@raeburn.org> |
| 2 | 8 | ||
| 3 | * puresize.h (BASE_PURESIZE): Increase to 610000. | 9 | * puresize.h (BASE_PURESIZE): Increase to 610000. |
diff --git a/src/search.c b/src/search.c index 5bcbaa615b3..3111548af58 100644 --- a/src/search.c +++ b/src/search.c | |||
| @@ -219,6 +219,13 @@ compile_pattern (pattern, regp, translate, posix, multibyte) | |||
| 219 | for (cpp = &searchbuf_head; ; cpp = &cp->next) | 219 | for (cpp = &searchbuf_head; ; cpp = &cp->next) |
| 220 | { | 220 | { |
| 221 | cp = *cpp; | 221 | cp = *cpp; |
| 222 | /* Entries are initialized to nil, and may be set to nil by | ||
| 223 | compile_pattern_1 if the pattern isn't valid. Don't apply | ||
| 224 | XSTRING in those cases. However, compile_pattern_1 is only | ||
| 225 | applied to the cache entry we pick here to reuse. So nil | ||
| 226 | should never appear before a non-nil entry. */ | ||
| 227 | if (cp->regexp == Qnil) | ||
| 228 | goto compile_it; | ||
| 222 | if (XSTRING (cp->regexp)->size == XSTRING (pattern)->size | 229 | if (XSTRING (cp->regexp)->size == XSTRING (pattern)->size |
| 223 | && !NILP (Fstring_equal (cp->regexp, pattern)) | 230 | && !NILP (Fstring_equal (cp->regexp, pattern)) |
| 224 | && EQ (cp->buf.translate, (! NILP (translate) ? translate : make_number (0))) | 231 | && EQ (cp->buf.translate, (! NILP (translate) ? translate : make_number (0))) |
| @@ -226,9 +233,12 @@ compile_pattern (pattern, regp, translate, posix, multibyte) | |||
| 226 | && cp->buf.multibyte == multibyte) | 233 | && cp->buf.multibyte == multibyte) |
| 227 | break; | 234 | break; |
| 228 | 235 | ||
| 229 | /* If we're at the end of the cache, compile into the last cell. */ | 236 | /* If we're at the end of the cache, compile into the nil cell |
| 237 | we found, or the last (least recently used) cell with a | ||
| 238 | string value. */ | ||
| 230 | if (cp->next == 0) | 239 | if (cp->next == 0) |
| 231 | { | 240 | { |
| 241 | compile_it: | ||
| 232 | compile_pattern_1 (cp, pattern, translate, regp, posix, multibyte); | 242 | compile_pattern_1 (cp, pattern, translate, regp, posix, multibyte); |
| 233 | break; | 243 | break; |
| 234 | } | 244 | } |