[hackers] [scc] The most portable solution in the world || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Wed, 7 Oct 2015 21:56:04 +0200 (CEST)

commit 7e16db5266a4c029474fe364b70b4bd77190ab43
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Wed Oct 7 21:55:28 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Wed Oct 7 21:55:28 2015 +0200

    The most portable solution in the world
    
    The portable god will be very happy with us today.

diff --git a/cc1/lex.c b/cc1/lex.c
index 48c3281..827185b 100644
--- a/cc1/lex.c
+++ b/cc1/lex.c
_AT_@ -273,7 +273,8 @@ readint(char *s, int base, int sign, Symbol *sym)
                 ++s;
 
         for (u = 0; isxdigit(c = *s++); u = u*base + val) {
- val = (isdigit(c)) ? c - '0' : 10 + toupper(c) - 'A';
+ static char letters[] = "0123456789ABCDEF";
+ val = strchr(letters, c) - letters;
         repeat:
                 if (u <= max/base && u*base <= max - val)
                         continue;
Received on Wed Oct 07 2015 - 21:56:04 CEST

This archive was generated by hypermail 2.3.0 : Wed Oct 07 2015 - 22:00:18 CEST