aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppfiles.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cppfiles.c')
-rw-r--r--gcc/cppfiles.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/gcc/cppfiles.c b/gcc/cppfiles.c
index cff8cd2..98b79af 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;