diff options
author | Akim Demaille <akim.demaille@gmail.com> | 2021-02-25 08:31:50 +0100 |
---|---|---|
committer | Akim Demaille <akim.demaille@gmail.com> | 2021-02-26 07:16:57 +0100 |
commit | f6eb1ac87bd08f2231fc28b14129c1b458da3bdf (patch) | |
tree | d9fe71230f475d1ee697a8618142c6982403ceec /src/muscle-tab.c | |
parent | b96528b48c7524f093a65a39a1601e98a9e031a4 (diff) | |
download | bison-f6eb1ac87bd08f2231fc28b14129c1b458da3bdf.tar.gz |
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.
Diffstat (limited to 'src/muscle-tab.c')
-rw-r--r-- | src/muscle-tab.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/muscle-tab.c b/src/muscle-tab.c index 3e7657ca..0654a3f1 100644 --- a/src/muscle-tab.c +++ b/src/muscle-tab.c @@ -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, "", ""); |