Commit def3263a by Nathan Sidwell Committed by Nathan Sidwell

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
parent 30235724
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> 2000-11-01 Bernd Schmidt <bernds@redhat.co.uk>
* expr.h (fold_builtin): Move declaration... * expr.h (fold_builtin): Move declaration...
......
...@@ -145,9 +145,13 @@ open_file (pfile, filename) ...@@ -145,9 +145,13 @@ open_file (pfile, filename)
if (file->fd == -2) if (file->fd == -2)
return 0; return 0;
/* -1 indicates a file we've opened previously, and since closed. */ /* Don't reopen an idempotent file. */
if (file->fd != -1) if (DO_NOT_REREAD (file))
return file; return file;
/* Don't reopen one which is already loaded. */
if (file->buffer != NULL)
return file;
} }
else else
{ {
...@@ -181,7 +185,11 @@ open_file (pfile, filename) ...@@ -181,7 +185,11 @@ open_file (pfile, filename)
{ {
/* Mark a regular, zero-length file never-reread now. */ /* Mark a regular, zero-length file never-reread now. */
if (S_ISREG (file->st.st_mode) && file->st.st_size == 0) 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; return file;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment