parser: make input() return char

Now that read errors are dealt with immediately, input() will never
return anything but a character.  Change its return type to char,
and change the type of the variable in yylex() that holds its return
value to char as well.

Signed-off-by: Alex Elder <elder@linaro.org>
Message-Id: <20211001232338.769309-9-elder@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
This commit is contained in:
Alex Elder 2021-10-01 18:23:12 -05:00 committed by Bjorn Andersson
parent 28c48a5e18
commit 6b15855aad

View File

@ -58,13 +58,13 @@ static void yyerror(const char *fmt, ...)
exit(1); exit(1);
} }
static int input() static char input()
{ {
static char input_buf[128]; static char input_buf[128];
static unsigned input_pos; static unsigned input_pos;
static unsigned input_len; static unsigned input_len;
int ret; int ret;
int ch; char ch;
if (scratch_pos) { if (scratch_pos) {
ch = scratch_buf[--scratch_pos]; ch = scratch_buf[--scratch_pos];
@ -148,7 +148,7 @@ static struct token yylex()
char buf[128]; char buf[128];
char *p = buf; char *p = buf;
int base; int base;
int ch; char ch;
while ((ch = input()) && isspace(ch)) while ((ch = input()) && isspace(ch))
; ;