From 23710a79b3d1eaeb23c78bfc4b3fba0326bb6c79 Mon Sep 17 00:00:00 2001 From: Alex Elder Date: Fri, 1 Oct 2021 18:23:07 -0500 Subject: [PATCH] parser: don't bother with a buffer in yyerror() Just print the message passed to yyerror(); don't bother putting it into a buffer first. Signed-off-by: Alex Elder Message-Id: <20211001232338.769309-4-elder@linaro.org> Signed-off-by: Bjorn Andersson --- parser.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/parser.c b/parser.c index 7b6794b..b9df130 100644 --- a/parser.c +++ b/parser.c @@ -183,15 +183,16 @@ static struct token curr_token; static void yyerror(const char *fmt, ...) { - char buf[128]; va_list ap; va_start(ap, fmt); - vsprintf(buf, fmt, ap); - printf("parse error on line %u: %s\n", yyline, buf); + printf("parse error on line %u:\n\t", yyline); + vprintf(fmt, ap); + printf("\n"); va_end(ap); + exit(1); }