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
This commit is contained in:
Zack Weinberg 2000-03-14 17:25:24 +00:00 committed by Zack Weinberg
parent 07fd50eab4
commit 5648866613
2 changed files with 17 additions and 5 deletions

View File

@ -1,3 +1,8 @@
2000-03-14 Zack Weinberg <zack@wolery.cumb.org>
* 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

View File

@ -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;