Mercurial > emacs
changeset 22221:239a4b800303
(shrink_regexp_cache): New function.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 24 May 1998 23:24:25 +0000 |
parents | a0cd311af6e3 |
children | 8e667bbef6d6 |
files | src/search.c |
diffstat | 1 files changed, 17 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/search.c Sun May 24 23:23:59 1998 +0000 +++ b/src/search.c Sun May 24 23:24:25 1998 +0000 @@ -182,6 +182,23 @@ cp->regexp = Fcopy_sequence (pattern); } +/* Shrink each compiled regexp buffer in the cache + to the size actually used right now. + This is called from garbage collection. */ + +void +shrink_regexp_cache () +{ + struct regexp_cache *cp, **cpp; + + for (cp = searchbuf_head; cp != 0; cp = cp->next) + { + cp->buf.allocated = cp->buf.used; + cp->buf.buffer + = (unsigned char *) realloc (cp->buf.buffer, cp->buf.used); + } +} + /* Compile a regexp if necessary, but first check to see if there's one in the cache. PATTERN is the pattern to compile.