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 <elder@linaro.org>
Message-Id: <20211001232338.769309-4-elder@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
This commit is contained in:
Alex Elder
2021-10-01 18:23:07 -05:00
committed by Bjorn Andersson
parent 8dcad17a55
commit 23710a79b3

View File

@@ -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);
}