diff options
author | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-03-14 17:25:24 +0000 |
---|---|---|
committer | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-03-14 17:25:24 +0000 |
commit | 770b6a87e08d13456521fb1a0fe5b0696a2803f9 (patch) | |
tree | 1dabbfd632cc325b3591c3e04a219eb0ed4826ab /gcc/cppfiles.c | |
parent | 91981c104b5b61afa6c78a63702a170d88dbbd65 (diff) | |
download | ppe42-gcc-770b6a87e08d13456521fb1a0fe5b0696a2803f9.tar.gz ppe42-gcc-770b6a87e08d13456521fb1a0fe5b0696a2803f9.zip |
* cppfiles.c (find_include_file): Don't assume nshort is a
substring of name.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32533 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cppfiles.c')
-rw-r--r-- | gcc/cppfiles.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/gcc/cppfiles.c b/gcc/cppfiles.c index cff8cd2ea5f..98b79af9966 100644 --- a/gcc/cppfiles.c +++ b/gcc/cppfiles.c @@ -257,13 +257,20 @@ find_include_file (pfile, fname, search_start, ihash, before) if (f == -1) return -1; - ih = (IHASH *) xmalloc (sizeof (IHASH) + strlen (name)); - strcpy ((char *)ih->name, name); - ih->foundhere = path; if (path == ABSOLUTE_PATH) - ih->nshort = ih->name; + { + ih = (IHASH *) xmalloc (sizeof (IHASH) + strlen (name)); + ih->nshort = ih->name; + } else - ih->nshort = strstr (ih->name, fname); + { + ih = (IHASH *) xmalloc (sizeof (IHASH) + strlen (name) + + strlen (fname) + 1); + ih->nshort = ih->name + strlen (fname) + 1; + strcpy ((char *)ih->nshort, fname); + } + strcpy ((char *)ih->name, name); + ih->foundhere = path; ih->control_macro = NULL; ih->hash = dummy.hash; |