cppfiles.c (open_file): If already read, then don't reopen.
* cppfiles.c (open_file): If already read, then don't reopen. Immediately close an empty file. From-SVN: r37227
This commit is contained in:
parent
30235724a2
commit
def3263a33
@ -1,3 +1,8 @@
|
||||
2000-11-03 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
* cppfiles.c (open_file): If already read, then don't reopen.
|
||||
Immediately close an empty file.
|
||||
|
||||
2000-11-01 Bernd Schmidt <bernds@redhat.co.uk>
|
||||
|
||||
* expr.h (fold_builtin): Move declaration...
|
||||
|
@ -145,9 +145,13 @@ open_file (pfile, filename)
|
||||
if (file->fd == -2)
|
||||
return 0;
|
||||
|
||||
/* -1 indicates a file we've opened previously, and since closed. */
|
||||
if (file->fd != -1)
|
||||
return file;
|
||||
/* Don't reopen an idempotent file. */
|
||||
if (DO_NOT_REREAD (file))
|
||||
return file;
|
||||
|
||||
/* Don't reopen one which is already loaded. */
|
||||
if (file->buffer != NULL)
|
||||
return file;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -181,7 +185,11 @@ open_file (pfile, filename)
|
||||
{
|
||||
/* Mark a regular, zero-length file never-reread now. */
|
||||
if (S_ISREG (file->st.st_mode) && file->st.st_size == 0)
|
||||
file->cmacro = NEVER_REREAD;
|
||||
{
|
||||
file->cmacro = NEVER_REREAD;
|
||||
close (file->fd);
|
||||
file->fd = -1;
|
||||
}
|
||||
|
||||
return file;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user