bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI: More free


From: Akim Demaille
Subject: FYI: More free
Date: 25 Sep 2001 20:44:42 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Artificial Intelligence)

Index: ChangeLog
from  Akim Demaille  <address@hidden>

        * src/system.h: Include `xalloc.h'.
        Remove it from the C files.
        * src/files.c (output_files): Free the obstacks.
        * src/lex.c (init_lex): Rename as...
        (lex_init): this.
        (lex_free): New.
        * src/main.c (main): Use it.

Index: src/LR0.c
===================================================================
RCS file: /cvsroot/bison/bison/src/LR0.c,v
retrieving revision 1.15.2.1
diff -u -u -r1.15.2.1 LR0.c
--- src/LR0.c 2001/09/22 17:19:03 1.15.2.1
+++ src/LR0.c 2001/09/25 18:34:54
@@ -23,7 +23,6 @@
    The entry point is generate_states.  */
 
 #include "system.h"
-#include "xalloc.h"
 #include "gram.h"
 #include "state.h"
 #include "complain.h"
Index: src/closure.c
===================================================================
RCS file: /cvsroot/bison/bison/src/closure.c,v
retrieving revision 1.13
diff -u -u -r1.13 closure.c
--- src/closure.c 2000/11/07 16:28:46 1.13
+++ src/closure.c 2001/09/25 18:34:54
@@ -19,7 +19,6 @@
    02111-1307, USA.  */
 
 #include "system.h"
-#include "xalloc.h"
 #include "gram.h"
 #include "closure.h"
 #include "derives.h"
Index: src/conflicts.c
===================================================================
RCS file: /cvsroot/bison/bison/src/conflicts.c,v
retrieving revision 1.22.2.2
diff -u -u -r1.22.2.2 conflicts.c
--- src/conflicts.c 2001/09/24 08:15:53 1.22.2.2
+++ src/conflicts.c 2001/09/25 18:34:54
@@ -20,7 +20,6 @@
 
 #include "system.h"
 #include "getargs.h"
-#include "xalloc.h"
 #include "files.h"
 #include "gram.h"
 #include "state.h"
Index: src/derives.c
===================================================================
RCS file: /cvsroot/bison/bison/src/derives.c,v
retrieving revision 1.13
diff -u -u -r1.13 derives.c
--- src/derives.c 2000/11/07 16:28:46 1.13
+++ src/derives.c 2001/09/25 18:34:54
@@ -25,7 +25,6 @@
    */
 
 #include "system.h"
-#include "xalloc.h"
 #include "types.h"
 #include "gram.h"
 #include "derives.h"
Index: src/files.c
===================================================================
RCS file: /cvsroot/bison/bison/src/files.c,v
retrieving revision 1.51.2.7
diff -u -u -r1.51.2.7 files.c
--- src/files.c 2001/09/24 15:54:18 1.51.2.7
+++ src/files.c 2001/09/25 18:34:54
@@ -22,7 +22,6 @@
 #include "system.h"
 #include "getargs.h"
 #include "files.h"
-#include "xalloc.h"
 #include "gram.h"
 #include "complain.h"
 
@@ -467,14 +466,17 @@
     obstack_save (&table_obstack, spec_outfile);
   else
     obstack_save (&table_obstack, stringappend (base_name, src_extension));
+  obstack_free (&table_obstack, NULL);
 
   /* Output the header file if wanted. */
   if (defines_flag)
     defines_obstack_save (spec_defines_file);
+  obstack_free (&defines_obstack, NULL);
 
   /* If we output only the table, dump the actions in ACTFILE. */
   if (no_parser_flag)
     obstack_save (&action_obstack, stringappend (short_base_name, ".act"));
+  obstack_free (&action_obstack, NULL);
 
   /* If we produced a semantic parser ATTRS_OBSTACK must be dumped
      into its own file, ATTTRSFILE.  */
@@ -483,10 +485,12 @@
       char *temp_name;
 
       obstack_save (&attrs_obstack, attrsfile);
+      obstack_free (&attrs_obstack, NULL);
       temp_name = stringappend (short_base_name, EXT_GUARD_C);
 #ifndef MSDOS
       temp_name = stringappend (temp_name, src_extension);
 #endif /* MSDOS */
       obstack_save (&guard_obstack, temp_name);
+      obstack_free (&guard_obstack, NULL);
     }
 }
Index: src/lalr.c
===================================================================
RCS file: /cvsroot/bison/bison/src/lalr.c,v
retrieving revision 1.16
diff -u -u -r1.16 lalr.c
--- src/lalr.c 2000/11/07 16:28:46 1.16
+++ src/lalr.c 2001/09/25 18:34:54
@@ -26,7 +26,6 @@
 #include "system.h"
 #include "types.h"
 #include "LR0.h"
-#include "xalloc.h"
 #include "gram.h"
 #include "complain.h"
 #include "lalr.h"
Index: src/lex.c
===================================================================
RCS file: /cvsroot/bison/bison/src/lex.c,v
retrieving revision 1.33.2.4
diff -u -u -r1.33.2.4 lex.c
--- src/lex.c 2001/09/22 17:43:26 1.33.2.4
+++ src/lex.c 2001/09/25 18:34:54
@@ -24,7 +24,6 @@
 #include "getopt.h"            /* for optarg */
 #include "symtab.h"
 #include "lex.h"
-#include "xalloc.h"
 #include "complain.h"
 #include "gram.h"
 #include "quote.h"
@@ -43,10 +42,17 @@
 
 
 void
-init_lex (void)
+lex_init (void)
 {
   obstack_init (&token_obstack);
   unlexed = tok_undef;
+}
+
+
+void
+lex_free (void)
+{
+  obstack_free (&token_obstack, NULL);
 }
 
 
Index: src/lex.h
===================================================================
RCS file: /cvsroot/bison/bison/src/lex.h,v
retrieving revision 1.13.2.2
diff -u -u -r1.13.2.2 lex.h
--- src/lex.h 2001/09/17 22:21:16 1.13.2.2
+++ src/lex.h 2001/09/25 18:34:54
@@ -58,7 +58,8 @@
 extern bucket *symval;
 extern int numval;
 
-void init_lex PARAMS ((void));
+void lex_init PARAMS ((void));
+void lex_free PARAMS ((void));
 int skip_white_space PARAMS ((void));
 void unlex PARAMS ((int));
 void read_type_name PARAMS ((FILE *fin));
Index: src/main.c
===================================================================
RCS file: /cvsroot/bison/bison/src/main.c,v
retrieving revision 1.30.2.2
diff -u -u -r1.30.2.2 main.c
--- src/main.c 2001/09/24 08:15:53 1.30.2.2
+++ src/main.c 2001/09/25 18:34:54
@@ -102,6 +102,8 @@
   /* Free the symbol table data structure.  */
   free_symtab ();
 
+  lex_free ();
+
   /* Close the input files. */
   close_files ();
 
Index: src/nullable.c
===================================================================
RCS file: /cvsroot/bison/bison/src/nullable.c,v
retrieving revision 1.10
diff -u -u -r1.10 nullable.c
--- src/nullable.c 2000/11/07 16:28:47 1.10
+++ src/nullable.c 2001/09/25 18:34:54
@@ -26,7 +26,6 @@
 #include "system.h"
 #include "types.h"
 #include "gram.h"
-#include "xalloc.h"
 #include "nullable.h"
 
 char *nullable = NULL;
Index: src/output.c
===================================================================
RCS file: /cvsroot/bison/bison/src/output.c,v
retrieving revision 1.39.2.3
diff -u -u -r1.39.2.3 output.c
--- src/output.c 2001/09/22 17:57:59 1.39.2.3
+++ src/output.c 2001/09/25 18:34:54
@@ -94,7 +94,6 @@
 #include "obstack.h"
 #include "quotearg.h"
 #include "getargs.h"
-#include "xalloc.h"
 #include "files.h"
 #include "gram.h"
 #include "LR0.h"
Index: src/print.c
===================================================================
RCS file: /cvsroot/bison/bison/src/print.c,v
retrieving revision 1.17.2.2
diff -u -u -r1.17.2.2 print.c
--- src/print.c 2001/09/24 08:15:53 1.17.2.2
+++ src/print.c 2001/09/25 18:34:54
@@ -20,7 +20,6 @@
 
 
 #include "system.h"
-#include "xalloc.h"
 #include "files.h"
 #include "gram.h"
 #include "LR0.h"
Index: src/print_graph.c
===================================================================
RCS file: /cvsroot/bison/bison/src/print_graph.c,v
retrieving revision 1.6.2.4
diff -u -u -r1.6.2.4 print_graph.c
--- src/print_graph.c 2001/09/24 15:54:18 1.6.2.4
+++ src/print_graph.c 2001/09/25 18:34:54
@@ -19,7 +19,6 @@
    Boston, MA 02111-1307, USA.  */
 
 #include "system.h"
-#include "xalloc.h"
 #include "files.h"
 #include "gram.h"
 #include "LR0.h"
Index: src/reader.c
===================================================================
RCS file: /cvsroot/bison/bison/src/reader.c,v
retrieving revision 1.72.2.8
diff -u -u -r1.72.2.8 reader.c
--- src/reader.c 2001/09/24 08:15:53 1.72.2.8
+++ src/reader.c 2001/09/25 18:34:54
@@ -26,7 +26,6 @@
 #include "quote.h"
 #include "getargs.h"
 #include "files.h"
-#include "xalloc.h"
 #include "symtab.h"
 #include "lex.h"
 #include "gram.h"
@@ -1912,7 +1911,7 @@
 
   grammar = NULL;
 
-  init_lex ();
+  lex_init ();
   lineno = 1;
 
   /* Initialize the symbol table.  */
Index: src/reduce.c
===================================================================
RCS file: /cvsroot/bison/bison/src/reduce.c,v
retrieving revision 1.19.2.1
diff -u -u -r1.19.2.1 reduce.c
--- src/reduce.c 2001/09/20 17:08:42 1.19.2.1
+++ src/reduce.c 2001/09/25 18:34:54
@@ -29,7 +29,6 @@
 #include "getargs.h"
 #include "files.h"
 #include "gram.h"
-#include "xalloc.h"
 #include "complain.h"
 #include "reduce.h"
 #include "reader.h"
Index: src/symtab.c
===================================================================
RCS file: /cvsroot/bison/bison/src/symtab.c,v
retrieving revision 1.13.2.1
diff -u -u -r1.13.2.1 symtab.c
--- src/symtab.c 2001/09/22 17:57:59 1.13.2.1
+++ src/symtab.c 2001/09/25 18:34:54
@@ -20,7 +20,6 @@
 
 
 #include "system.h"
-#include "xalloc.h"
 #include "symtab.h"
 #include "gram.h"
 
Index: src/system.h
===================================================================
RCS file: /cvsroot/bison/bison/src/system.h,v
retrieving revision 1.23.2.1
diff -u -u -r1.23.2.1 system.h
--- src/system.h 2001/09/22 17:19:03 1.23.2.1
+++ src/system.h 2001/09/25 18:34:54
@@ -73,8 +73,8 @@
 # define PARAMS(p) ()
 #endif
 
+# include "xalloc.h"
 
-
 /*---------------------.
 | Missing prototypes.  |
 `---------------------*/
@@ -159,9 +159,9 @@
 | Obstacks.  |
 `-----------*/
 
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free  free
-#include "obstack.h"
+# define obstack_chunk_alloc xmalloc
+# define obstack_chunk_free  free
+# include "obstack.h"
 
 #define obstack_sgrow(Obs, Str) \
   obstack_grow (Obs, Str, strlen (Str))
@@ -271,8 +271,6 @@
 # if WITH_DMALLOC
 #  define DMALLOC_FUNC_CHECK
 #  include <dmalloc.h>
-
 # endif /* WITH_DMALLOC */
-
 
 #endif  /* BISON_SYSTEM_H */
Index: src/vcg.c
===================================================================
RCS file: /cvsroot/bison/bison/src/vcg.c,v
retrieving revision 1.5.2.5
diff -u -u -r1.5.2.5 vcg.c
--- src/vcg.c 2001/09/24 15:54:18 1.5.2.5
+++ src/vcg.c 2001/09/25 18:34:54
@@ -19,7 +19,6 @@
    Boston, MA 02111-1307, USA.  */
 
 #include "system.h"
-#include "xalloc.h"
 #include "vcg.h"
 #include "vcg_defaults.h"
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]