cppfiles.c (open_file_pch): Don't put unused entries in the splay tree.

* cppfiles.c (open_file_pch): Don't put unused entries in the
	splay tree.  Remove dead code.

From-SVN: r69647
This commit is contained in:
Neil Booth 2003-07-21 20:57:00 +00:00 committed by Neil Booth
parent 49a64b2462
commit 8d973a8319
2 changed files with 35 additions and 33 deletions

View File

@ -1,3 +1,8 @@
2003-07-21 Neil Booth <neil@daikokuya.co.uk>
* cppfiles.c (open_file_pch): Don't put unused entries in the
splay tree. Remove dead code.
2003-07-21 Geoffrey Keating <geoffk@apple.com>
* c-pragma.c (maybe_apply_pragma_weak): Don't get DECL_ASSEMBLER_NAME

View File

@ -301,50 +301,47 @@ open_file_pch (cpp_reader *pfile, const char *filename)
{
size_t namelen = strlen (filename);
char *pchname = alloca (namelen + 5);
struct include_file * file;
splay_tree_node nd;
struct include_file *file = NULL;
struct stat st;
memcpy (pchname, filename, namelen);
memcpy (pchname + namelen, ".gch", 5);
cpp_simplify_path (pchname);
nd = find_or_create_entry (pfile, pchname);
file = (struct include_file *) nd->value;
if (file != NULL)
if (stat (pchname, &st) == 0 && S_ISDIR (st.st_mode))
{
if (stat (file->name, &file->st) == 0 && S_ISDIR (file->st.st_mode))
{
DIR * thedir;
struct dirent *d;
size_t subname_len = namelen + 64;
char *subname = xmalloc (subname_len);
DIR * thedir;
struct dirent *d;
size_t subname_len = namelen + 64;
char *subname = xmalloc (subname_len);
thedir = opendir (pchname);
if (thedir == NULL)
return NULL;
memcpy (subname, pchname, namelen + 4);
subname[namelen+4] = '/';
while ((d = readdir (thedir)) != NULL)
thedir = opendir (pchname);
if (thedir == NULL)
return NULL;
memcpy (subname, pchname, namelen + 4);
subname[namelen+4] = '/';
while ((d = readdir (thedir)) != NULL)
{
if (strlen (d->d_name) + namelen + 7 > subname_len)
{
if (strlen (d->d_name) + namelen + 7 > subname_len)
{
subname_len = strlen (d->d_name) + namelen + 64;
subname = xrealloc (subname, subname_len);
}
strcpy (subname + namelen + 5, d->d_name);
file = validate_pch (pfile, filename, subname);
if (file)
break;
subname_len = strlen (d->d_name) + namelen + 64;
subname = xrealloc (subname, subname_len);
}
closedir (thedir);
free (subname);
strcpy (subname + namelen + 5, d->d_name);
file = validate_pch (pfile, filename, subname);
if (file)
break;
}
else
file = validate_pch (pfile, filename, pchname);
if (file)
return file;
closedir (thedir);
free (subname);
}
else
file = validate_pch (pfile, filename, pchname);
if (file)
return file;
}
return open_file (pfile, filename);
}