Commit 591e15a1 by Neil Booth Committed by Neil Booth

cppfiles.c (struct include_file): Update.

        * cppfiles.c (struct include_file): Update.
        (stack_include_file): Use search_from.
        (cpp_included, find_include_file): Update.
        (cpp_execute_include): Update.  ptr->name may not be
        null terminated.  Use the new search_from member variable
        of cpp_buffer.
        (_cpp_compare_file_date): Similarly.
        (search_from): New function, similiar to actual_directory.
        (actual_directory): Delete.
        (remap_filename): Update.  loc->name may not be null terminated.
        (struct file_name_list): Rename search_path.  Update.
        * cpphash.h (struct cpp_buffer): Delete actual_dir.  New members
        search_from and dir.
        (struct cpp_reader): Remove actual_dirs.
        * cppinit.c (struct cpp_pending): Update for renamed objects.
        (append_include_chain, remove_dup_dir, remove_dup_dirs,
        merge_include_chains, cpp_destroy, cpp_start_read): Similarly.
        * cpplib.h (struct cpp_options): Similarly.

From-SVN: r40178
parent c04278f7
2001-03-02 Neil Booth <neil@daikokuya.demon.co.uk>
* cppfiles.c (struct include_file): Update.
(stack_include_file): Use search_from.
(cpp_included, find_include_file): Update.
(cpp_execute_include): Update. ptr->name may not be
null terminated. Use the new search_from member variable
of cpp_buffer.
(_cpp_compare_file_date): Similarly.
(search_from): New function, similiar to actual_directory.
(actual_directory): Delete.
(remap_filename): Update. loc->name may not be null terminated.
(struct file_name_list): Rename search_path. Update.
* cpphash.h (struct cpp_buffer): Delete actual_dir. New members
search_from and dir.
(struct cpp_reader): Remove actual_dirs.
* cppinit.c (struct cpp_pending): Update for renamed objects.
(append_include_chain, remove_dup_dir, remove_dup_dirs,
merge_include_chains, cpp_destroy, cpp_start_read): Similarly.
* cpplib.h (struct cpp_options): Similarly.
2001-03-01 Zack Weinberg <zackw@stanford.edu> 2001-03-01 Zack Weinberg <zackw@stanford.edu>
* config/xm-lynx.h, config/xm-std32.h, config/a29k/xm-a29k.h, * config/xm-lynx.h, config/xm-std32.h, config/a29k/xm-a29k.h,
......
...@@ -68,7 +68,7 @@ struct include_file ...@@ -68,7 +68,7 @@ struct include_file
{ {
const char *name; /* actual path name of file */ const char *name; /* actual path name of file */
const cpp_hashnode *cmacro; /* macro, if any, preventing reinclusion. */ const cpp_hashnode *cmacro; /* macro, if any, preventing reinclusion. */
const struct file_name_list *foundhere; const struct search_path *foundhere;
/* location in search path where file was /* location in search path where file was
found, for #include_next and sysp. */ found, for #include_next and sysp. */
const unsigned char *buffer; /* pointer to cached file contents */ const unsigned char *buffer; /* pointer to cached file contents */
...@@ -94,12 +94,12 @@ static struct file_name_map *read_name_map ...@@ -94,12 +94,12 @@ static struct file_name_map *read_name_map
PARAMS ((cpp_reader *, const char *)); PARAMS ((cpp_reader *, const char *));
static char *read_filename_string PARAMS ((int, FILE *)); static char *read_filename_string PARAMS ((int, FILE *));
static char *remap_filename PARAMS ((cpp_reader *, char *, static char *remap_filename PARAMS ((cpp_reader *, char *,
struct file_name_list *)); struct search_path *));
static struct file_name_list *actual_directory static struct search_path *search_from PARAMS ((cpp_reader *,
PARAMS ((cpp_reader *, const char *)); struct include_file *));
static struct include_file *find_include_file static struct include_file *find_include_file
PARAMS ((cpp_reader *, const char *, PARAMS ((cpp_reader *, const char *,
struct file_name_list *)); struct search_path *));
static struct include_file *open_file PARAMS ((cpp_reader *, const char *)); static struct include_file *open_file PARAMS ((cpp_reader *, const char *));
static void read_include_file PARAMS ((cpp_reader *, struct include_file *)); static void read_include_file PARAMS ((cpp_reader *, struct include_file *));
static void stack_include_file PARAMS ((cpp_reader *, struct include_file *)); static void stack_include_file PARAMS ((cpp_reader *, struct include_file *));
...@@ -296,11 +296,7 @@ stack_include_file (pfile, inc) ...@@ -296,11 +296,7 @@ stack_include_file (pfile, inc)
fp->inc = inc; fp->inc = inc;
fp->inc->refcnt++; fp->inc->refcnt++;
fp->sysp = sysp; fp->sysp = sysp;
fp->search_from = search_from (pfile, inc);
/* The ->actual_dir field is only used when ignore_srcdir is not in effect;
see do_include */
if (!CPP_OPTION (pfile, ignore_srcdir))
fp->actual_dir = actual_directory (pfile, inc->name);
/* Initialise controlling macro state. */ /* Initialise controlling macro state. */
pfile->mi_state = MI_OUTSIDE; pfile->mi_state = MI_OUTSIDE;
...@@ -461,7 +457,7 @@ cpp_included (pfile, fname) ...@@ -461,7 +457,7 @@ cpp_included (pfile, fname)
cpp_reader *pfile; cpp_reader *pfile;
const char *fname; const char *fname;
{ {
struct file_name_list *path; struct search_path *path;
char *name; char *name;
splay_tree_node nd; splay_tree_node nd;
...@@ -477,9 +473,9 @@ cpp_included (pfile, fname) ...@@ -477,9 +473,9 @@ cpp_included (pfile, fname)
+ 2 + INCLUDE_LEN_FUDGE); + 2 + INCLUDE_LEN_FUDGE);
for (path = CPP_OPTION (pfile, quote_include); path; path = path->next) for (path = CPP_OPTION (pfile, quote_include); path; path = path->next)
{ {
memcpy (name, path->name, path->nlen); memcpy (name, path->name, path->len);
name[path->nlen] = '/'; name[path->len] = '/';
strcpy (&name[path->nlen+1], fname); strcpy (&name[path->len + 1], fname);
_cpp_simplify_pathname (name); _cpp_simplify_pathname (name);
if (CPP_OPTION (pfile, remap)) if (CPP_OPTION (pfile, remap))
name = remap_filename (pfile, name, path); name = remap_filename (pfile, name, path);
...@@ -499,9 +495,9 @@ static struct include_file * ...@@ -499,9 +495,9 @@ static struct include_file *
find_include_file (pfile, fname, search_start) find_include_file (pfile, fname, search_start)
cpp_reader *pfile; cpp_reader *pfile;
const char *fname; const char *fname;
struct file_name_list *search_start; struct search_path *search_start;
{ {
struct file_name_list *path; struct search_path *path;
char *name; char *name;
struct include_file *file; struct include_file *file;
...@@ -513,9 +509,9 @@ find_include_file (pfile, fname, search_start) ...@@ -513,9 +509,9 @@ find_include_file (pfile, fname, search_start)
+ 2 + INCLUDE_LEN_FUDGE); + 2 + INCLUDE_LEN_FUDGE);
for (path = search_start; path; path = path->next) for (path = search_start; path; path = path->next)
{ {
memcpy (name, path->name, path->nlen); memcpy (name, path->name, path->len);
name[path->nlen] = '/'; name[path->len] = '/';
strcpy (&name[path->nlen+1], fname); strcpy (&name[path->len + 1], fname);
_cpp_simplify_pathname (name); _cpp_simplify_pathname (name);
if (CPP_OPTION (pfile, remap)) if (CPP_OPTION (pfile, remap))
name = remap_filename (pfile, name, path); name = remap_filename (pfile, name, path);
...@@ -527,6 +523,7 @@ find_include_file (pfile, fname, search_start) ...@@ -527,6 +523,7 @@ find_include_file (pfile, fname, search_start)
return file; return file;
} }
} }
return 0; return 0;
} }
...@@ -587,7 +584,7 @@ _cpp_execute_include (pfile, header, no_reinclude, include_next) ...@@ -587,7 +584,7 @@ _cpp_execute_include (pfile, header, no_reinclude, include_next)
int no_reinclude; int no_reinclude;
int include_next; int include_next;
{ {
struct file_name_list *search_start = 0; struct search_path *search_start = 0;
unsigned int len = header->val.str.len; unsigned int len = header->val.str.len;
unsigned int angle_brackets = header->type == CPP_HEADER_NAME; unsigned int angle_brackets = header->type == CPP_HEADER_NAME;
struct include_file *inc; struct include_file *inc;
...@@ -637,10 +634,8 @@ _cpp_execute_include (pfile, header, no_reinclude, include_next) ...@@ -637,10 +634,8 @@ _cpp_execute_include (pfile, header, no_reinclude, include_next)
{ {
if (angle_brackets) if (angle_brackets)
search_start = CPP_OPTION (pfile, bracket_include); search_start = CPP_OPTION (pfile, bracket_include);
else if (CPP_OPTION (pfile, ignore_srcdir))
search_start = CPP_OPTION (pfile, quote_include);
else else
search_start = CPP_BUFFER (pfile)->actual_dir; search_start = pfile->buffer->search_from;
if (!search_start) if (!search_start)
{ {
...@@ -685,17 +680,18 @@ _cpp_execute_include (pfile, header, no_reinclude, include_next) ...@@ -685,17 +680,18 @@ _cpp_execute_include (pfile, header, no_reinclude, include_next)
else else
{ {
char *p; char *p;
struct file_name_list *ptr; struct search_path *ptr;
int len; int len;
/* If requested as a system header, assume it belongs in /* If requested as a system header, assume it belongs in
the first system header directory. */ the first system header directory. */
if (CPP_OPTION (pfile, bracket_include)) if (CPP_OPTION (pfile, bracket_include))
ptr = CPP_OPTION (pfile, bracket_include); ptr = CPP_OPTION (pfile, bracket_include);
else else
ptr = CPP_OPTION (pfile, quote_include); ptr = CPP_OPTION (pfile, quote_include);
len = strlen (ptr->name); /* FIXME: ptr can be null, no? */
len = ptr->len;
p = (char *) alloca (len + strlen (fname) + 2); p = (char *) alloca (len + strlen (fname) + 2);
if (len) if (len)
{ {
...@@ -728,15 +724,13 @@ _cpp_compare_file_date (pfile, f) ...@@ -728,15 +724,13 @@ _cpp_compare_file_date (pfile, f)
{ {
unsigned int len = f->val.str.len; unsigned int len = f->val.str.len;
char *fname; char *fname;
struct file_name_list *search_start; struct search_path *search_start;
struct include_file *inc; struct include_file *inc;
if (f->type == CPP_HEADER_NAME) if (f->type == CPP_HEADER_NAME)
search_start = CPP_OPTION (pfile, bracket_include); search_start = CPP_OPTION (pfile, bracket_include);
else if (CPP_OPTION (pfile, ignore_srcdir)) else if (CPP_OPTION (pfile, ignore_srcdir))
search_start = CPP_OPTION (pfile, quote_include); search_start = pfile->buffer->search_from;
else
search_start = CPP_BUFFER (pfile)->actual_dir;
fname = alloca (len + 1); fname = alloca (len + 1);
memcpy (fname, f->val.str.text, len); memcpy (fname, f->val.str.text, len);
...@@ -804,6 +798,47 @@ _cpp_pop_file_buffer (pfile, buf) ...@@ -804,6 +798,47 @@ _cpp_pop_file_buffer (pfile, buf)
purge_cache (inc); purge_cache (inc);
} }
/* Returns the first place in the include chain to start searching for
"" includes. This involves stripping away the basename of the
current file, unless -I- was specified. */
static struct search_path *
search_from (pfile, inc)
cpp_reader *pfile;
struct include_file *inc;
{
cpp_buffer *buffer = pfile->buffer;
unsigned int dlen;
/* Ignore the current file's directory if -I- was given. */
if (CPP_OPTION (pfile, ignore_srcdir))
return CPP_OPTION (pfile, quote_include);
dlen = basename (inc->name) - inc->name;
if (dlen)
{
/* We don't guarantee NAME is null-terminated. This saves
allocating and freeing memory, and duplicating it when faking
buffers in cpp_push_buffer. Drop a trailing '/'. */
buffer->dir.name = inc->name;
if (dlen > 1)
dlen--;
}
else
{
buffer->dir.name = ".";
dlen = 1;
}
if (dlen > pfile->max_include_len)
pfile->max_include_len = dlen;
buffer->dir.len = dlen;
buffer->dir.next = CPP_OPTION (pfile, quote_include);
buffer->dir.sysp = buffer->sysp;
return &buffer->dir;
}
/* The file_name_map structure holds a mapping of file names for a /* The file_name_map structure holds a mapping of file names for a
particular directory. This mapping is read from the file named particular directory. This mapping is read from the file named
FILE_NAME_MAP_FILE in that directory. Such a file can be used to FILE_NAME_MAP_FILE in that directory. Such a file can be used to
...@@ -950,20 +985,26 @@ static char * ...@@ -950,20 +985,26 @@ static char *
remap_filename (pfile, name, loc) remap_filename (pfile, name, loc)
cpp_reader *pfile; cpp_reader *pfile;
char *name; char *name;
struct file_name_list *loc; struct search_path *loc;
{ {
struct file_name_map *map; struct file_name_map *map;
const char *from, *p; const char *from, *p;
char *dir; char *dir, *dname;
/* Get a null-terminated path. */
dname = alloca (loc->len + 1);
memcpy (dname, loc->name, loc->len);
dname[loc->len] = '\0';
if (! loc->name_map) if (! loc->name_map)
{ {
loc->name_map = read_name_map (pfile, loc->name ? loc->name : "."); loc->name_map = read_name_map (pfile, dname);
if (! loc->name_map) if (! loc->name_map)
return name; return name;
} }
from = name + strlen (loc->name) + 1; /* FIXME: this doesn't look right - NAME has been simplified. */
from = name + loc->len + 1;
for (map = loc->name_map; map; map = map->map_next) for (map = loc->name_map; map; map = map->map_next)
if (!strcmp (map->map_from, from)) if (!strcmp (map->map_from, from))
...@@ -993,65 +1034,6 @@ remap_filename (pfile, name, loc) ...@@ -993,65 +1034,6 @@ remap_filename (pfile, name, loc)
return name; return name;
} }
/* Given a path FNAME, extract the directory component and place it
onto the actual_dirs list. Return a pointer to the allocated
file_name_list structure. These structures are used to implement
current-directory "" include searching. */
static struct file_name_list *
actual_directory (pfile, fname)
cpp_reader *pfile;
const char *fname;
{
char *last_slash, *dir;
size_t dlen;
struct file_name_list *x;
dir = xstrdup (fname);
last_slash = strrchr (dir, '/');
if (last_slash)
{
if (last_slash == dir)
{
dlen = 1;
last_slash[1] = '\0';
}
else
{
dlen = last_slash - dir;
*last_slash = '\0';
}
}
else
{
free (dir);
dir = xstrdup (".");
dlen = 1;
}
if (dlen > pfile->max_include_len)
pfile->max_include_len = dlen;
for (x = pfile->actual_dirs; x; x = x->alloc)
if (!strcmp (x->name, dir))
{
free (dir);
return x;
}
/* Not found, make a new one. */
x = (struct file_name_list *) xmalloc (sizeof (struct file_name_list));
x->name = dir;
x->nlen = dlen;
x->next = CPP_OPTION (pfile, quote_include);
x->alloc = pfile->actual_dirs;
x->sysp = pfile->buffer->sysp;
x->name_map = NULL;
pfile->actual_dirs = x;
return x;
}
/* Simplify a path name in place, deleting redundant components. This /* Simplify a path name in place, deleting redundant components. This
reduces OS overhead and guarantees that equivalent paths compare reduces OS overhead and guarantees that equivalent paths compare
the same (modulo symlinks). the same (modulo symlinks).
......
...@@ -72,23 +72,23 @@ struct cpp_pool ...@@ -72,23 +72,23 @@ struct cpp_pool
unsigned int locks; unsigned int locks;
}; };
/* List of directories to look for include files in. */ /* List of directories to look for include files in. */
struct file_name_list struct search_path
{ {
struct file_name_list *next; struct search_path *next;
struct file_name_list *alloc; /* for the cache of
current directory entries */ /* NOTE: NAME may not be null terminated for the case of the current
char *name; file's directory! */
unsigned int nlen; const char *name;
unsigned int len;
/* We use these to tell if the directory mentioned here is a duplicate /* We use these to tell if the directory mentioned here is a duplicate
of an earlier directory on the search path. */ of an earlier directory on the search path. */
ino_t ino; ino_t ino;
dev_t dev; dev_t dev;
/* If the following is nonzero, it is a C-language system include /* Non-zero if it is a system include directory. */
directory. */
int sysp; int sysp;
/* Mapping of file names for this directory. /* Mapping of file names for this directory. Only used on MS-DOS
Only used on MS-DOS and related platforms. */ and related platforms. */
struct file_name_map *name_map; struct file_name_map *name_map;
}; };
...@@ -180,9 +180,6 @@ struct cpp_buffer ...@@ -180,9 +180,6 @@ struct cpp_buffer
/* Filename specified with #line command. */ /* Filename specified with #line command. */
const char *nominal_fname; const char *nominal_fname;
/* Actual directory of this file, used only for "" includes */
struct file_name_list *actual_dir;
/* Pointer into the include table. Used for include_next and /* Pointer into the include table. Used for include_next and
to record control macros. */ to record control macros. */
struct include_file *inc; struct include_file *inc;
...@@ -227,6 +224,15 @@ struct cpp_buffer ...@@ -227,6 +224,15 @@ struct cpp_buffer
/* Buffer type. */ /* Buffer type. */
ENUM_BITFIELD (cpp_buffer_type) type : 8; ENUM_BITFIELD (cpp_buffer_type) type : 8;
/* The directory of the this buffer's file. Its NAME member is not
allocated, so we don't need to worry about freeing it. */
struct search_path dir;
/* The directory to start searching for "" include files. Is either
"dir" above, or options.quote_include, depending upon whether -I-
was on the command line. */
struct search_path *search_from;
}; };
/* A cpp_reader encapsulates the "state" of a pre-processor run. /* A cpp_reader encapsulates the "state" of a pre-processor run.
...@@ -297,10 +303,6 @@ struct cpp_reader ...@@ -297,10 +303,6 @@ struct cpp_reader
/* Tree of other included files. See cppfiles.c. */ /* Tree of other included files. See cppfiles.c. */
struct splay_tree_s *all_include_files; struct splay_tree_s *all_include_files;
/* Chain of `actual directory' file_name_list entries, for ""
inclusion. */
struct file_name_list *actual_dirs;
/* Current maximum length of directory names in the search path /* Current maximum length of directory names in the search path
for include files. (Altered as we get more of them.) */ for include files. (Altered as we get more of them.) */
unsigned int max_include_len; unsigned int max_include_len;
......
...@@ -70,10 +70,10 @@ struct cpp_pending ...@@ -70,10 +70,10 @@ struct cpp_pending
{ {
struct pending_option *directive_head, *directive_tail; struct pending_option *directive_head, *directive_tail;
struct file_name_list *quote_head, *quote_tail; struct search_path *quote_head, *quote_tail;
struct file_name_list *brack_head, *brack_tail; struct search_path *brack_head, *brack_tail;
struct file_name_list *systm_head, *systm_tail; struct search_path *systm_head, *systm_tail;
struct file_name_list *after_head, *after_tail; struct search_path *after_head, *after_tail;
struct pending_option *imacros_head, *imacros_tail; struct pending_option *imacros_head, *imacros_tail;
struct pending_option *include_head, *include_tail; struct pending_option *include_head, *include_tail;
...@@ -100,10 +100,10 @@ static void init_library PARAMS ((void)); ...@@ -100,10 +100,10 @@ static void init_library PARAMS ((void));
static void init_builtins PARAMS ((cpp_reader *)); static void init_builtins PARAMS ((cpp_reader *));
static void append_include_chain PARAMS ((cpp_reader *, static void append_include_chain PARAMS ((cpp_reader *,
char *, int, int)); char *, int, int));
struct file_name_list * remove_dup_dir PARAMS ((cpp_reader *, struct search_path * remove_dup_dir PARAMS ((cpp_reader *,
struct file_name_list *)); struct search_path *));
struct file_name_list * remove_dup_dirs PARAMS ((cpp_reader *, struct search_path * remove_dup_dirs PARAMS ((cpp_reader *,
struct file_name_list *)); struct search_path *));
static void merge_include_chains PARAMS ((cpp_reader *)); static void merge_include_chains PARAMS ((cpp_reader *));
static void do_includes PARAMS ((cpp_reader *, static void do_includes PARAMS ((cpp_reader *,
struct pending_option *, struct pending_option *,
...@@ -207,7 +207,7 @@ append_include_chain (pfile, dir, path, cxx_aware) ...@@ -207,7 +207,7 @@ append_include_chain (pfile, dir, path, cxx_aware)
int cxx_aware ATTRIBUTE_UNUSED; int cxx_aware ATTRIBUTE_UNUSED;
{ {
struct cpp_pending *pend = CPP_OPTION (pfile, pending); struct cpp_pending *pend = CPP_OPTION (pfile, pending);
struct file_name_list *new; struct search_path *new;
struct stat st; struct stat st;
unsigned int len; unsigned int len;
...@@ -232,9 +232,9 @@ append_include_chain (pfile, dir, path, cxx_aware) ...@@ -232,9 +232,9 @@ append_include_chain (pfile, dir, path, cxx_aware)
if (len > pfile->max_include_len) if (len > pfile->max_include_len)
pfile->max_include_len = len; pfile->max_include_len = len;
new = (struct file_name_list *) xmalloc (sizeof (struct file_name_list)); new = (struct search_path *) xmalloc (sizeof (struct search_path));
new->name = dir; new->name = dir;
new->nlen = len; new->len = len;
new->ino = st.st_ino; new->ino = st.st_ino;
new->dev = st.st_dev; new->dev = st.st_dev;
if (path == SYSTEM) if (path == SYSTEM)
...@@ -247,7 +247,6 @@ append_include_chain (pfile, dir, path, cxx_aware) ...@@ -247,7 +247,6 @@ append_include_chain (pfile, dir, path, cxx_aware)
new->sysp = 0; new->sysp = 0;
new->name_map = NULL; new->name_map = NULL;
new->next = NULL; new->next = NULL;
new->alloc = NULL;
switch (path) switch (path)
{ {
...@@ -260,18 +259,18 @@ append_include_chain (pfile, dir, path, cxx_aware) ...@@ -260,18 +259,18 @@ append_include_chain (pfile, dir, path, cxx_aware)
/* Handle a duplicated include path. PREV is the link in the chain /* Handle a duplicated include path. PREV is the link in the chain
before the duplicate. The duplicate is removed from the chain and before the duplicate. The duplicate is removed from the chain and
freed. Returns PREV. */ freed. Returns PREV. */
struct file_name_list * struct search_path *
remove_dup_dir (pfile, prev) remove_dup_dir (pfile, prev)
cpp_reader *pfile; cpp_reader *pfile;
struct file_name_list *prev; struct search_path *prev;
{ {
struct file_name_list *cur = prev->next; struct search_path *cur = prev->next;
if (CPP_OPTION (pfile, verbose)) if (CPP_OPTION (pfile, verbose))
fprintf (stderr, _("ignoring duplicate directory \"%s\"\n"), cur->name); fprintf (stderr, _("ignoring duplicate directory \"%s\"\n"), cur->name);
prev->next = cur->next; prev->next = cur->next;
free (cur->name); free ((PTR) cur->name);
free (cur); free (cur);
return prev; return prev;
...@@ -281,12 +280,12 @@ remove_dup_dir (pfile, prev) ...@@ -281,12 +280,12 @@ remove_dup_dir (pfile, prev)
chain, or NULL if the chain is empty. This algorithm is quadratic chain, or NULL if the chain is empty. This algorithm is quadratic
in the number of -I switches, which is acceptable since there in the number of -I switches, which is acceptable since there
aren't usually that many of them. */ aren't usually that many of them. */
struct file_name_list * struct search_path *
remove_dup_dirs (pfile, head) remove_dup_dirs (pfile, head)
cpp_reader *pfile; cpp_reader *pfile;
struct file_name_list *head; struct search_path *head;
{ {
struct file_name_list *prev = NULL, *cur, *other; struct search_path *prev = NULL, *cur, *other;
for (cur = head; cur; cur = cur->next) for (cur = head; cur; cur = cur->next)
{ {
...@@ -315,7 +314,7 @@ static void ...@@ -315,7 +314,7 @@ static void
merge_include_chains (pfile) merge_include_chains (pfile)
cpp_reader *pfile; cpp_reader *pfile;
{ {
struct file_name_list *quote, *brack, *systm, *qtail; struct search_path *quote, *brack, *systm, *qtail;
struct cpp_pending *pend = CPP_OPTION (pfile, pending); struct cpp_pending *pend = CPP_OPTION (pfile, pending);
...@@ -559,7 +558,7 @@ cpp_destroy (pfile) ...@@ -559,7 +558,7 @@ cpp_destroy (pfile)
cpp_reader *pfile; cpp_reader *pfile;
{ {
int result; int result;
struct file_name_list *dir, *dirn; struct search_path *dir, *dirn;
cpp_context *context, *contextn; cpp_context *context, *contextn;
while (CPP_BUFFER (pfile) != NULL) while (CPP_BUFFER (pfile) != NULL)
...@@ -587,7 +586,7 @@ cpp_destroy (pfile) ...@@ -587,7 +586,7 @@ cpp_destroy (pfile)
for (dir = CPP_OPTION (pfile, quote_include); dir; dir = dirn) for (dir = CPP_OPTION (pfile, quote_include); dir; dir = dirn)
{ {
dirn = dir->next; dirn = dir->next;
free (dir->name); free ((PTR) dir->name);
free (dir); free (dir);
} }
...@@ -910,7 +909,7 @@ cpp_start_read (pfile, fname) ...@@ -910,7 +909,7 @@ cpp_start_read (pfile, fname)
/* With -v, print the list of dirs to search. */ /* With -v, print the list of dirs to search. */
if (CPP_OPTION (pfile, verbose)) if (CPP_OPTION (pfile, verbose))
{ {
struct file_name_list *l; struct search_path *l;
fprintf (stderr, _("#include \"...\" search starts here:\n")); fprintf (stderr, _("#include \"...\" search starts here:\n"));
for (l = CPP_OPTION (pfile, quote_include); l; l = l->next) for (l = CPP_OPTION (pfile, quote_include); l; l = l->next)
{ {
......
...@@ -240,8 +240,8 @@ struct cpp_options ...@@ -240,8 +240,8 @@ struct cpp_options
const char *deps_file; const char *deps_file;
/* Search paths for include files. */ /* Search paths for include files. */
struct file_name_list *quote_include; /* First dir to search for "file" */ struct search_path *quote_include; /* "" */
struct file_name_list *bracket_include;/* First dir to search for <file> */ struct search_path *bracket_include; /* <> */
/* Map between header names and file names, used only on DOS where /* Map between header names and file names, used only on DOS where
file names are limited in length. */ file names are limited in length. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment