cppfiles.c (purge_cache): use munmap() only if MMAP_THRESHOLD defined.

* cppfiles.c (purge_cache): use munmap() only if MMAP_THRESHOLD
	 defined.
	(read_include_file): Ensure inc->mmaped is initialized.

From-SVN: r36459
This commit is contained in:
Laurynas Biveinis 2000-09-16 18:17:53 +00:00 committed by Neil Booth
parent 6f84c9bdaa
commit ae0f4dee02
2 changed files with 9 additions and 1 deletions

View File

@ -1,3 +1,9 @@
Sat 16-Sep-2000 19:14:00 BST Laurynas Biveinis <lauras@softhome.net>
* cppfiles.c (purge_cache): use munmap() only if MMAP_THRESHOLD
defined.
(read_include_file): Ensure inc->mmaped is initialized.
2000-09-16 Richard Henderson <rth@cygnus.com>
* cppiles.c (purge_cache): Use PTR not caddr_t.

View File

@ -272,6 +272,7 @@ read_include_file (pfile, inc)
}
size = inc->st.st_size;
inc->mapped = 0;
#if MMAP_THRESHOLD
if (pagesize == -1)
pagesize = getpagesize ();
@ -300,7 +301,6 @@ read_include_file (pfile, inc)
}
offset += count;
}
inc->mapped = 0;
}
}
else if (S_ISBLK (inc->st.st_mode))
@ -363,9 +363,11 @@ purge_cache (inc)
{
if (inc->buffer)
{
#if MMAP_THRESHOLD
if (inc->mapped)
munmap ((PTR) inc->buffer, inc->st.st_size);
else
#endif
free ((PTR) inc->buffer);
inc->buffer = NULL;
}