diff options
| author | Richard M. Stallman | 1998-05-24 23:24:25 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-05-24 23:24:25 +0000 |
| commit | 6efc788795e564750837da362acf9326febc1ff1 (patch) | |
| tree | 95d6cd8baa2e8207dc79e4feb82c98a64affdb5a /src | |
| parent | eec7b73dba4ce7bbddf175f65966c5bb1e572fce (diff) | |
| download | emacs-6efc788795e564750837da362acf9326febc1ff1.tar.gz emacs-6efc788795e564750837da362acf9326febc1ff1.zip | |
(shrink_regexp_cache): New function.
Diffstat (limited to 'src')
| -rw-r--r-- | src/search.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/search.c b/src/search.c index 175ae8a3f65..d9d445afad0 100644 --- a/src/search.c +++ b/src/search.c | |||
| @@ -182,6 +182,23 @@ compile_pattern_1 (cp, pattern, translate, regp, posix, multibyte) | |||
| 182 | cp->regexp = Fcopy_sequence (pattern); | 182 | cp->regexp = Fcopy_sequence (pattern); |
| 183 | } | 183 | } |
| 184 | 184 | ||
| 185 | /* Shrink each compiled regexp buffer in the cache | ||
| 186 | to the size actually used right now. | ||
| 187 | This is called from garbage collection. */ | ||
| 188 | |||
| 189 | void | ||
| 190 | shrink_regexp_cache () | ||
| 191 | { | ||
| 192 | struct regexp_cache *cp, **cpp; | ||
| 193 | |||
| 194 | for (cp = searchbuf_head; cp != 0; cp = cp->next) | ||
| 195 | { | ||
| 196 | cp->buf.allocated = cp->buf.used; | ||
| 197 | cp->buf.buffer | ||
| 198 | = (unsigned char *) realloc (cp->buf.buffer, cp->buf.used); | ||
| 199 | } | ||
| 200 | } | ||
| 201 | |||
| 185 | /* Compile a regexp if necessary, but first check to see if there's one in | 202 | /* Compile a regexp if necessary, but first check to see if there's one in |
| 186 | the cache. | 203 | the cache. |
| 187 | PATTERN is the pattern to compile. | 204 | PATTERN is the pattern to compile. |