From 99dd2088803c5feaefc3804396d264e6838dcd05 Mon Sep 17 00:00:00 2001 From: "Wolfgang (Blub) Bumiller" Date: Fri, 16 Nov 2012 22:07:53 +0100 Subject: [PATCH] moving ftepp_delete out of ftepp_preprocess so that it can actually be called recursively --- ftepp.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/ftepp.c b/ftepp.c index e1a8e30..d4cf761 100644 --- a/ftepp.c +++ b/ftepp.c @@ -827,7 +827,6 @@ static bool ftepp_preprocess(ftepp_t *ftepp) } while (!ftepp->errors && ftepp->token < TOKEN_EOF); newline = ftepp->token == TOKEN_EOF; - ftepp_delete(ftepp); return newline; } @@ -839,7 +838,12 @@ bool ftepp_preprocess_file(const char *filename) con_out("failed to open file \"%s\"\n", filename); return false; } - return ftepp_preprocess(ftepp); + if (!ftepp_preprocess(ftepp)) { + ftepp_delete(ftepp); + return false; + } + ftepp_delete(ftepp); + return true; } bool ftepp_preprocess_string(const char *name, const char *str) @@ -850,5 +854,10 @@ bool ftepp_preprocess_string(const char *name, const char *str) con_out("failed to create lexer for string \"%s\"\n", name); return false; } - return ftepp_preprocess(ftepp); + if (!ftepp_preprocess(ftepp)) { + ftepp_delete(ftepp); + return false; + } + ftepp_delete(ftepp); + return true; } -- 2.39.2