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

View File

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