]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
update old_string after a recursive preprocess call so we don't reset to a free'd...
authorWolfgang (Blub) Bumiller <blub@speed.at>
Sun, 18 Nov 2012 13:39:24 +0000 (14:39 +0100)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Sun, 18 Nov 2012 13:39:24 +0000 (14:39 +0100)
ftepp.c

diff --git a/ftepp.c b/ftepp.c
index ad5e7c757549e164e29313ede2cdf8823fc09c78..f0c34e47c2435015b37386b07bf03fb545abd996 100644 (file)
--- a/ftepp.c
+++ b/ftepp.c
@@ -483,6 +483,16 @@ static void ftepp_stringify(ftepp_t *ftepp, macroparam *param)
     ftepp_out(ftepp, "\"", false);
 }
 
+static void ftepp_recursion_header(ftepp_t *ftepp)
+{
+    ftepp_out(ftepp, "\n#pragma push(line)\n", false);
+}
+
+static void ftepp_recursion_footer(ftepp_t *ftepp)
+{
+    ftepp_out(ftepp, "\n#pragma pop(line)\n", false);
+}
+
 static bool ftepp_preprocess(ftepp_t *ftepp);
 static bool ftepp_macro_expand(ftepp_t *ftepp, ppmacro *macro, macroparam *params)
 {
@@ -560,11 +570,14 @@ static bool ftepp_macro_expand(ftepp_t *ftepp, ppmacro *macro, macroparam *param
     }
     ftepp->output_string = old_string;
     ftepp->lex = inlex;
+    ftepp_recursion_header(ftepp);
     if (!ftepp_preprocess(ftepp)) {
         lex_close(ftepp->lex);
         retval = false;
         goto cleanup;
     }
+    ftepp_recursion_footer(ftepp);
+    old_string = ftepp->output_string;
 
 cleanup:
     ftepp->lex           = old_lexer;