comparison src/search.c @ 22221:239a4b800303

(shrink_regexp_cache): New function.
author Richard M. Stallman <rms@gnu.org>
date Sun, 24 May 1998 23:24:25 +0000
parents 84bcdbc46d71
children 6eae236a4f01
comparison
equal deleted inserted replaced
22220:a0cd311af6e3 22221:239a4b800303
178 UNBLOCK_INPUT; 178 UNBLOCK_INPUT;
179 if (val) 179 if (val)
180 Fsignal (Qinvalid_regexp, Fcons (build_string (val), Qnil)); 180 Fsignal (Qinvalid_regexp, Fcons (build_string (val), Qnil));
181 181
182 cp->regexp = Fcopy_sequence (pattern); 182 cp->regexp = Fcopy_sequence (pattern);
183 }
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 }
183 } 200 }
184 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.