]> git.saurik.com Git - bison.git/commitdiff
* src/system.h: Include `xalloc.h'.
authorAkim Demaille <akim@epita.fr>
Tue, 25 Sep 2001 18:35:04 +0000 (18:35 +0000)
committerAkim Demaille <akim@epita.fr>
Tue, 25 Sep 2001 18:35:04 +0000 (18:35 +0000)
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.

19 files changed:
ChangeLog
src/LR0.c
src/closure.c
src/conflicts.c
src/derives.c
src/files.c
src/lalr.c
src/lex.c
src/lex.h
src/main.c
src/nullable.c
src/output.c
src/print.c
src/print_graph.c
src/reader.c
src/reduce.c
src/symtab.c
src/system.h
src/vcg.c

index 6d6384aa84d745c7028e8831002cfc93a71de565..5aad14215cdf0b268073fd60b19a7673716a60ed 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2001-09-25  Akim Demaille  <akim@epita.fr>
+
+       * 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.
+
 2001-09-24  Marc Autret  <autret_m@epita.fr>
 
        * src/vcg.c (open_edge, close_edge, open_node, close_node): Change
 2001-09-24  Marc Autret  <autret_m@epita.fr>
 
        * src/vcg.c (open_edge, close_edge, open_node, close_node): Change
index 644d2644415f91aa223754cfceed078366f33db5..133a8218c2fcd046cebff0135a7cb08ee652c947 100644 (file)
--- a/src/LR0.c
+++ b/src/LR0.c
@@ -23,7 +23,6 @@
    The entry point is generate_states.  */
 
 #include "system.h"
    The entry point is generate_states.  */
 
 #include "system.h"
-#include "xalloc.h"
 #include "gram.h"
 #include "state.h"
 #include "complain.h"
 #include "gram.h"
 #include "state.h"
 #include "complain.h"
index 6d3d22078faabdced2af1a5081d2b6e6c819e9d5..03a59f0bfb79732f9ba8c26e52db79c1547cd2b4 100644 (file)
@@ -19,7 +19,6 @@
    02111-1307, USA.  */
 
 #include "system.h"
    02111-1307, USA.  */
 
 #include "system.h"
-#include "xalloc.h"
 #include "gram.h"
 #include "closure.h"
 #include "derives.h"
 #include "gram.h"
 #include "closure.h"
 #include "derives.h"
index dc9ee3d6a2aa5f4b4617275ce5f6b0df61e3770b..626db9348306f187874ba1dd9d7614dbe0fff820 100644 (file)
@@ -20,7 +20,6 @@
 
 #include "system.h"
 #include "getargs.h"
 
 #include "system.h"
 #include "getargs.h"
-#include "xalloc.h"
 #include "files.h"
 #include "gram.h"
 #include "state.h"
 #include "files.h"
 #include "gram.h"
 #include "state.h"
index 49b4edff13f47eff439836cc3fb95a9c7bf10ab5..e9c756494036372fb03464f015a13dadfa3f9a02 100644 (file)
@@ -25,7 +25,6 @@
    */
 
 #include "system.h"
    */
 
 #include "system.h"
-#include "xalloc.h"
 #include "types.h"
 #include "gram.h"
 #include "derives.h"
 #include "types.h"
 #include "gram.h"
 #include "derives.h"
index 3966ef554e0194d30d13a25e6a18398898422d32..628ce8f2736b84ffb63894d55a7c36525c5398d4 100644 (file)
@@ -22,7 +22,6 @@
 #include "system.h"
 #include "getargs.h"
 #include "files.h"
 #include "system.h"
 #include "getargs.h"
 #include "files.h"
-#include "xalloc.h"
 #include "gram.h"
 #include "complain.h"
 
 #include "gram.h"
 #include "complain.h"
 
@@ -467,14 +466,17 @@ output_files (void)
     obstack_save (&table_obstack, spec_outfile);
   else
     obstack_save (&table_obstack, stringappend (base_name, src_extension));
     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);
 
   /* 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"));
 
   /* 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.  */
 
   /* If we produced a semantic parser ATTRS_OBSTACK must be dumped
      into its own file, ATTTRSFILE.  */
@@ -483,10 +485,12 @@ output_files (void)
       char *temp_name;
 
       obstack_save (&attrs_obstack, attrsfile);
       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);
       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 7e8aff70146dc51d227e3c116d4d5eaa6d6ae839..48635ef316d993262f90691f6033305ad0a8643d 100644 (file)
@@ -26,7 +26,6 @@
 #include "system.h"
 #include "types.h"
 #include "LR0.h"
 #include "system.h"
 #include "types.h"
 #include "LR0.h"
-#include "xalloc.h"
 #include "gram.h"
 #include "complain.h"
 #include "lalr.h"
 #include "gram.h"
 #include "complain.h"
 #include "lalr.h"
index ecb6507ea7176675c76bae40985537177bb3e847..6c66caac7cc309ecd409691623f0c71894c95a7a 100644 (file)
--- a/src/lex.c
+++ b/src/lex.c
@@ -24,7 +24,6 @@
 #include "getopt.h"            /* for optarg */
 #include "symtab.h"
 #include "lex.h"
 #include "getopt.h"            /* for optarg */
 #include "symtab.h"
 #include "lex.h"
-#include "xalloc.h"
 #include "complain.h"
 #include "gram.h"
 #include "quote.h"
 #include "complain.h"
 #include "gram.h"
 #include "quote.h"
@@ -43,13 +42,20 @@ static bucket *unlexed_symval = NULL;
 
 
 void
 
 
 void
-init_lex (void)
+lex_init (void)
 {
   obstack_init (&token_obstack);
   unlexed = tok_undef;
 }
 
 
 {
   obstack_init (&token_obstack);
   unlexed = tok_undef;
 }
 
 
+void
+lex_free (void)
+{
+  obstack_free (&token_obstack, NULL);
+}
+
+
 int
 skip_white_space (void)
 {
 int
 skip_white_space (void)
 {
index 1bf675a2189c4879df6314b9072ca29a40ec08b2..6a9b2f5add3c90bef949a651ba557db7d1c8fa20 100644 (file)
--- a/src/lex.h
+++ b/src/lex.h
@@ -58,7 +58,8 @@ extern const char *token_buffer;
 extern bucket *symval;
 extern int numval;
 
 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));
 int skip_white_space PARAMS ((void));
 void unlex PARAMS ((int));
 void read_type_name PARAMS ((FILE *fin));
index 6e7a87c0f333fdcd6850c6ca7e264a52a1c05223..60322cf350ded3ed5aaefdc1d89fb77a2140d169 100644 (file)
@@ -102,6 +102,8 @@ main (int argc, char *argv[])
   /* Free the symbol table data structure.  */
   free_symtab ();
 
   /* Free the symbol table data structure.  */
   free_symtab ();
 
+  lex_free ();
+
   /* Close the input files. */
   close_files ();
 
   /* Close the input files. */
   close_files ();
 
index 7240132f526e04914b81d359c23252211d3a7032..336549182d90ab246dd24a9c46bec20a6e2144a8 100644 (file)
@@ -26,7 +26,6 @@
 #include "system.h"
 #include "types.h"
 #include "gram.h"
 #include "system.h"
 #include "types.h"
 #include "gram.h"
-#include "xalloc.h"
 #include "nullable.h"
 
 char *nullable = NULL;
 #include "nullable.h"
 
 char *nullable = NULL;
index 83476c5f43ac5877131c0d57b7ed3148d504eeeb..19fcb01917b12f42a6f31a20d8faa254f24b3b2b 100644 (file)
@@ -94,7 +94,6 @@
 #include "obstack.h"
 #include "quotearg.h"
 #include "getargs.h"
 #include "obstack.h"
 #include "quotearg.h"
 #include "getargs.h"
-#include "xalloc.h"
 #include "files.h"
 #include "gram.h"
 #include "LR0.h"
 #include "files.h"
 #include "gram.h"
 #include "LR0.h"
index 619b8a7614feda6946b35f48a1c6a75de798bb38..ccafbdc645388b0463f645fac5cbd08ea7ac5e37 100644 (file)
@@ -20,7 +20,6 @@
 
 
 #include "system.h"
 
 
 #include "system.h"
-#include "xalloc.h"
 #include "files.h"
 #include "gram.h"
 #include "LR0.h"
 #include "files.h"
 #include "gram.h"
 #include "LR0.h"
index e326341a2351e6e758eb127ca2a44c0ad8b1c0be..a00434db52c4b092062c2fbd369135cbade59256 100644 (file)
@@ -19,7 +19,6 @@
    Boston, MA 02111-1307, USA.  */
 
 #include "system.h"
    Boston, MA 02111-1307, USA.  */
 
 #include "system.h"
-#include "xalloc.h"
 #include "files.h"
 #include "gram.h"
 #include "LR0.h"
 #include "files.h"
 #include "gram.h"
 #include "LR0.h"
index 2e4898467012f06a90980b26a58283fc807a99c8..5731bf8f1883ac0efa5ed869663240274e87fec0 100644 (file)
@@ -26,7 +26,6 @@
 #include "quote.h"
 #include "getargs.h"
 #include "files.h"
 #include "quote.h"
 #include "getargs.h"
 #include "files.h"
-#include "xalloc.h"
 #include "symtab.h"
 #include "lex.h"
 #include "gram.h"
 #include "symtab.h"
 #include "lex.h"
 #include "gram.h"
@@ -1912,7 +1911,7 @@ reader (void)
 
   grammar = NULL;
 
 
   grammar = NULL;
 
-  init_lex ();
+  lex_init ();
   lineno = 1;
 
   /* Initialize the symbol table.  */
   lineno = 1;
 
   /* Initialize the symbol table.  */
index ce295b5b7074c362d1017e2ad28d8e2107c33ed2..b2299b338fd66e992bd36bc9fb0dc06b1dff319d 100644 (file)
@@ -29,7 +29,6 @@
 #include "getargs.h"
 #include "files.h"
 #include "gram.h"
 #include "getargs.h"
 #include "files.h"
 #include "gram.h"
-#include "xalloc.h"
 #include "complain.h"
 #include "reduce.h"
 #include "reader.h"
 #include "complain.h"
 #include "reduce.h"
 #include "reader.h"
index bf4a882fa8d66532a17e5f8d7a20c98b49b86498..6e5d5ea9b7f13acccb4a50b00e37a44cb29df5ed 100644 (file)
@@ -20,7 +20,6 @@
 
 
 #include "system.h"
 
 
 #include "system.h"
-#include "xalloc.h"
 #include "symtab.h"
 #include "gram.h"
 
 #include "symtab.h"
 #include "gram.h"
 
index 5d15969ab7fe13018de3a36a7d69eef19229f10d..b3c8f6d94f130eac4bdf239de38d676b47cd55ee 100644 (file)
@@ -73,7 +73,7 @@ extern int errno;
 # define PARAMS(p) ()
 #endif
 
 # define PARAMS(p) ()
 #endif
 
-
+# include "xalloc.h"
 
 /*---------------------.
 | Missing prototypes.  |
 
 /*---------------------.
 | Missing prototypes.  |
@@ -159,9 +159,9 @@ typedef int bool;
 | Obstacks.  |
 `-----------*/
 
 | 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))
 
 #define obstack_sgrow(Obs, Str) \
   obstack_grow (Obs, Str, strlen (Str))
@@ -271,8 +271,6 @@ do {                                                                \
 # if WITH_DMALLOC
 #  define DMALLOC_FUNC_CHECK
 #  include <dmalloc.h>
 # if WITH_DMALLOC
 #  define DMALLOC_FUNC_CHECK
 #  include <dmalloc.h>
-
 # endif /* WITH_DMALLOC */
 
 # endif /* WITH_DMALLOC */
 
-
 #endif  /* BISON_SYSTEM_H */
 #endif  /* BISON_SYSTEM_H */
index 515e9a2f0712c31173f898349fe77cb3795305ca..f6466481e2362dc38cefb879b6ea4b9cee19cec4 100644 (file)
--- a/src/vcg.c
+++ b/src/vcg.c
@@ -19,7 +19,6 @@
    Boston, MA 02111-1307, USA.  */
 
 #include "system.h"
    Boston, MA 02111-1307, USA.  */
 
 #include "system.h"
-#include "xalloc.h"
 #include "vcg.h"
 #include "vcg_defaults.h"
 
 #include "vcg.h"
 #include "vcg_defaults.h"