scc

Simple C99 Compiler
Log | Files | Refs | README | LICENSE

commit 1accaa337ab984f599a4fe9c951ef14b7155f844
parent e277d35b631a1687a4eb1daca98397be829e3d11
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Wed,  7 Oct 2015 20:06:07 +0200

Use isdigit() in readint()

EBCDIC has letters before digits, so the previous code
was not working for it. Some boss in IBM will happy
today if he knows that scc is portable to IBM machines.

Diffstat:
cc1/lex.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cc1/lex.c b/cc1/lex.c @@ -273,7 +273,7 @@ readint(char *s, int base, int sign, Symbol *sym) ++s; for (u = 0; isxdigit(c = *s++); u = u*base + val) { - val = (c <= '9') ? c - '0' : 10 + toupper(c) - 'A'; + val = (isdigit(c)) ? c - '0' : 10 + toupper(c) - 'A'; repeat: if (u <= max/base && u*base <= max - val) continue;