mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-18 08:43:03 +00:00
output: cache the mapped file names
Don't repeatedly call malloc/free for each call to map_file_name. * bootstrap.conf: We need hash-map. * src/files.h, src/files.c (map_file_name): The caller must not free the result. Adjust callers. (mapped_dir_prefix, spec_mapped_header_file): Remove. * src/files.c (map_file_name): Rename as... (map_file_name_alloc): this. (mapped_files, map_file_name, string_equals, string_hash, string_free): New.
This commit is contained in:
@@ -204,10 +204,8 @@ static void
|
||||
muscle_syncline_grow (char const *key, location loc)
|
||||
{
|
||||
obstack_printf (&muscle_obstack, "]b4_syncline(%d, ", loc.start.line);
|
||||
char *f = map_file_name (loc.start.file);
|
||||
obstack_quote (&muscle_obstack,
|
||||
quotearg_style (c_quoting_style, f));
|
||||
free (f);
|
||||
quotearg_style (c_quoting_style, map_file_name (loc.start.file)));
|
||||
obstack_sgrow (&muscle_obstack, ")dnl\n[");
|
||||
char const *extension = obstack_finish0 (&muscle_obstack);
|
||||
muscle_grow (key, extension, "", "");
|
||||
|
||||
Reference in New Issue
Block a user