]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - parse.c
Fixed: block-labels were NULLed after being set -_-
[xonotic/gmqcc.git] / parse.c
diff --git a/parse.c b/parse.c
index 6423f5daa4b7d14979702843f5541e86e372ee15..4b4f1e62a233cd051048a9bd331d23a7134af11f 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -48,7 +48,7 @@ void compile_constant_debug() {
  * Generates a parse tree out of the lexees generated by the lexer.  This
  * is where the tree is built.  This is where valid check is performed.
  */
-int parse_gen(struct lex_file *file) {    
+int parse_gen(lex_file *file) {    
     int     token = 0;
     while ((token = lex_token(file)) != ERROR_LEX && file->length >= 0) {
         switch (token) {
@@ -262,8 +262,8 @@ int parse_gen(struct lex_file *file) {
                     if (token == '\n')
                         return error(file, ERROR_PARSE, "Invalid use of include preprocessor directive: wanted #include \"file.h\"\n");
                         
-                    char            *copy = util_strdup(file->lastok);
-                    struct lex_file *next = lex_include(file,   copy);
+                    char      *copy = util_strdup(file->lastok);
+                    lex_file  *next = lex_include(file,   copy);
                     
                     if (!next) {
                         error(file, ERROR_INTERNAL, "Include subsystem failure\n");
@@ -291,5 +291,14 @@ int parse_gen(struct lex_file *file) {
     }
     compile_constant_debug();
     lex_reset(file);
+    /* free constants */
+    {
+               size_t i = 0;
+               for (; i < compile_constants_elements; i++) {
+                       mem_d(compile_constants_data[i].name);
+                       mem_d(compile_constants_data[i].string);
+               }
+               mem_d(compile_constants_data);
+       }
     return 1;
 }