From 4c2e5d7ebf200b32711b6b6a1d4fd94287fc2394 Mon Sep 17 00:00:00 2001 From: "Wolfgang (Blub) Bumiller" Date: Sun, 18 Nov 2012 14:39:24 +0100 Subject: [PATCH] update old_string after a recursive preprocess call so we don't reset to a free'd vector; add recursion header/footer pragmas --- ftepp.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ftepp.c b/ftepp.c index ad5e7c7..f0c34e4 100644 --- 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; -- 2.39.2