]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
Enforce a trailing nul-byte after preprocessing
authorWolfgang (Blub) Bumiller <blub@speed.at>
Fri, 23 Nov 2012 18:34:24 +0000 (19:34 +0100)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Fri, 23 Nov 2012 18:34:24 +0000 (19:34 +0100)
ftepp.c

diff --git a/ftepp.c b/ftepp.c
index 679214f34003696af8c0e3cc637e557247c64f4a..68d46b24b7699b13acf19b99bd60a5d43dd4ebe8 100644 (file)
--- a/ftepp.c
+++ b/ftepp.c
@@ -1236,6 +1236,10 @@ static bool ftepp_preprocess(ftepp_t *ftepp)
         }
     } while (!ftepp->errors && ftepp->token < TOKEN_EOF);
 
+    /* force a 0 at the end but don't count it as added to the output */
+    vec_push(ftepp->output_string, 0);
+    vec_shrinkby(ftepp->output_string, 1);
+
     newline = ftepp->token == TOKEN_EOF;
     return newline;
 }