This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patch: tiny cpplib bug


Recent Zack's patch to cache memory buffers instead of file
descriptors introduced tiny bug. There is

#if MMAP_THRESHOLD
[...]
         buf = (U_CHAR *) mmap (0, size, PROT_READ, MAP_PRIVATE, inc->fd, 0);
[...]
         inc->mapped = 1;
#endif

But corresponding MMAP_THRESHOLD check is missing from purge_cache() and
prevents cpp from compiling under DJGPP. Here is a fix:

2000-09-16 Laurynas Biveinis <lauras@softhome.net>

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

Index: cppfiles.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cppfiles.c,v
retrieving revision 1.78
diff -u -r1.78 cppfiles.c
--- cppfiles.c	2000/09/12 03:42:29	1.78
+++ cppfiles.c	2000/09/16 09:22:05
@@ -363,9 +363,11 @@
 {
   if (inc->buffer)
     {
+#if MMAP_THRESHOLD
       if (inc->mapped)
 	munmap ((caddr_t) inc->buffer, inc->st.st_size);
       else
+#endif
 	free ((PTR) inc->buffer);
       inc->buffer = NULL;
     }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]