mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-15 15:23:02 +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:
11
src/files.h
11
src/files.h
@@ -53,15 +53,9 @@ extern char *spec_xml_file;
|
||||
/* File name specified with --header. */
|
||||
extern char *spec_header_file;
|
||||
|
||||
/* File name specified with --header, adjusted for mapped prefixes. */
|
||||
extern char *spec_mapped_header_file;
|
||||
|
||||
/* Directory prefix of output file names. */
|
||||
extern char *dir_prefix;
|
||||
|
||||
/* Directory prefix of output file name, adjusted for mapped prefixes. */
|
||||
extern char *mapped_dir_prefix;
|
||||
|
||||
/* The file name as given on the command line.
|
||||
Not named "input_file" because Flex uses this name for an argument,
|
||||
and therefore GCC warns about a name clash. */
|
||||
@@ -94,7 +88,10 @@ FILE *xfopen (const char *name, char const *mode);
|
||||
void xfclose (FILE *ptr);
|
||||
FILE *xfdopen (int fd, char const *mode);
|
||||
|
||||
char *map_file_name (char const *filename);
|
||||
/* Given an input file path, return a string that contains the path
|
||||
with the file prefix mapping rules applied, or NULL if the input
|
||||
was NULL. Do not free the return value. */
|
||||
const char *map_file_name (char const *filename);
|
||||
|
||||
/* Add a new file prefix mapping. If a file path starts with
|
||||
oldprefix, it will be replaced with newprefix. */
|
||||
|
||||
Reference in New Issue
Block a user