From 8dcad17a55aee92315ccf0dc76be22a1cd8e211e Mon Sep 17 00:00:00 2001 From: Alex Elder Date: Fri, 1 Oct 2021 18:23:06 -0500 Subject: [PATCH] parser: use unsigned for array indexes We have no use for negative array indexes, so change the types of the static variables scratch_pos, input_pos, and input_len to be unsigned. Signed-off-by: Alex Elder Message-Id: <20211001232338.769309-3-elder@linaro.org> Signed-off-by: Bjorn Andersson --- parser.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/parser.c b/parser.c index 707a315..7b6794b 100644 --- a/parser.c +++ b/parser.c @@ -38,15 +38,15 @@ struct token { }; static char scratch_buf[128]; -static int scratch_pos; +static unsigned scratch_pos; static int yyline = 1; static int input() { static char input_buf[128]; - static int input_pos; - static int input_len; + static unsigned input_pos; + static unsigned input_len; int ret; int ch; @@ -189,7 +189,7 @@ static void yyerror(const char *fmt, ...) va_start(ap, fmt); vsprintf(buf, fmt, ap); - printf("parse error on line %d: %s\n", yyline, buf); + printf("parse error on line %u: %s\n", yyline, buf); va_end(ap); exit(1);