]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
When erroring while parsing a function and the function had been added to the parser...
authorWolfgang (Blub) Bumiller <blub@speed.at>
Sun, 28 Oct 2012 14:28:39 +0000 (15:28 +0100)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Sun, 28 Oct 2012 14:28:39 +0000 (15:28 +0100)
parser.c

index d86521230766627a9af734f485d6b7a9225218a5..4ef7a07c26e56f198d60b9f18c957c67da4b1d6f 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -2197,12 +2197,12 @@ static bool parse_function_body(parser_t *parser, ast_value *var)
     parser->function = func;
     if (!parse_block_into(parser, block, true)) {
         ast_block_delete(block);
-        goto enderrfn;
+        goto enderrfn2;
     }
 
     if (!ast_function_blocks_add(func, block)) {
         ast_block_delete(block);
-        goto enderrfn;
+        goto enderrfn2;
     }
 
     parser->function = old;
@@ -2215,6 +2215,8 @@ static bool parse_function_body(parser_t *parser, ast_value *var)
         parseerror(parser, "missing semicolon after function body (mandatory with -std=qcc)");
     return retval;
 
+enderrfn2:
+    parser->functions_count--;
 enderrfn:
     ast_function_delete(func);
     var->constval.vfunc = NULL;