[hackers] [scc] Use isdigit() in readint() || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Wed, 7 Oct 2015 20:20:36 +0200 (CEST)

commit 1accaa337ab984f599a4fe9c951ef14b7155f844
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Wed Oct 7 20:06:07 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Wed Oct 7 20:06:07 2015 +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.

diff --git a/cc1/lex.c b/cc1/lex.c
index 8d5a65e..48c3281 100644
--- a/cc1/lex.c
+++ b/cc1/lex.c
_AT_@ -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;
Received on Wed Oct 07 2015 - 20:20:36 CEST

This archive was generated by hypermail 2.3.0 : Wed Oct 07 2015 - 20:24:11 CEST