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]
Other format: [Raw text]

[cs] patch to free buffer of main file


I checked the attached patch into the compile-server branch.

It frees the buffer and fragments for the main (.c) file(s).
It's a space-saving optimimixation.  (Though if/when we start
using the compile-server to re-compile changed sections only
of a main file, we'll want to revisit this.)
--
	--Per Bothner
per@bothner.com   http://per.bothner.com/


2003-12-01  Per Bothner  <pbothner@apple.com>

	* cppfiles.c (_cpp_pop_file_buffer):  Free buffer if main file.

Index: cppfiles.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cppfiles.c,v
retrieving revision 1.177.2.10
diff -u -p -r1.177.2.10 cppfiles.c
--- cppfiles.c	1 Dec 2003 06:08:14 -0000	1.177.2.10
+++ cppfiles.c	2 Dec 2003 07:34:47 -0000
@@ -1124,14 +1124,15 @@ _cpp_pop_file_buffer (cpp_reader *pfile,
   /* Invalidate control macros in the #including file.  */
   pfile->mi_valid = false;
 
-#if 0
-  if (file->buffer)
+  if (pfile->buffer == NULL)
     {
-      free ((void *) file->buffer);
-      file->buffer = NULL;
+      if (file->buffer)
+	{
+	  free ((void *) file->buffer);
+	  file->buffer = NULL;
+	}
+      purge_fragments (file);
     }
-  purge_fragments (file);
-#endif
 }
 
 /* Set the include chain for "" to QUOTE, for <> to BRACKET.  If

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