aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppfiles.c
diff options
context:
space:
mode:
authorZack Weinberg <zack@wolery.cumb.org>2000-03-14 17:25:24 +0000
committerZack Weinberg <zack@gcc.gnu.org>2000-03-14 17:25:24 +0000
commit5648866613a7d3a348a5a29c6494f1fe8ab0364a (patch)
tree1dabbfd632cc325b3591c3e04a219eb0ed4826ab /gcc/cppfiles.c
parent07fd50eab44f9bcd677655e6ad851e6f866a36b3 (diff)
downloadgcc-5648866613a7d3a348a5a29c6494f1fe8ab0364a.zip
gcc-5648866613a7d3a348a5a29c6494f1fe8ab0364a.tar.gz
gcc-5648866613a7d3a348a5a29c6494f1fe8ab0364a.tar.bz2
cppfiles.c (find_include_file): Don't assume nshort is a substring of name.
* cppfiles.c (find_include_file): Don't assume nshort is a substring of name. From-SVN: r32533
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;