diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 900a0869f61..ac181ce3119 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2000-03-14 Zack Weinberg + + * cppfiles.c (find_include_file): Don't assume nshort is a + substring of name. + Tue Mar 14 08:42:21 2000 Jeffrey A Law (law@cygnus.com) * configure.in (hppa configurations): Add pa32-regs.h to the 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)); + if (path == ABSOLUTE_PATH) + { + ih = (IHASH *) xmalloc (sizeof (IHASH) + strlen (name)); + ih->nshort = ih->name; + } + else + { + 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; - if (path == ABSOLUTE_PATH) - ih->nshort = ih->name; - else - ih->nshort = strstr (ih->name, fname); ih->control_macro = NULL; ih->hash = dummy.hash;