diff options
author | Adam Jackson <ajax@redhat.com> | 2010-10-14 13:45:31 -0400 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2010-10-18 15:33:02 -0400 |
commit | f8ec71603c796f3b272a0592cbb934c2a6e8d633 (patch) | |
tree | 93ec40f3e0db75059bf733abb0fe2d378325684e | |
parent | 52577ae8eeda64601db8dd425027cf8e4271b873 (diff) |
xfree86: Remove an open-coded strtoul()
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
-rw-r--r-- | hw/xfree86/parser/scan.c | 49 |
1 files changed, 1 insertions, 48 deletions
diff --git a/hw/xfree86/parser/scan.c b/hw/xfree86/parser/scan.c index e609bdfd5..97cd79c01 100644 --- a/hw/xfree86/parser/scan.c +++ b/hw/xfree86/parser/scan.c @@ -115,53 +115,6 @@ static int pushToken = LOCK_TOKEN; static int eol_seen = 0; /* private state to handle comments */ LexRec val; -/* - * xf86strToUL -- - * - * A portable, but restricted, version of strtoul(). It only understands - * hex, octal, and decimal. But it's good enough for our needs. - */ -static unsigned int -xf86strToUL (char *str) -{ - int base = 10; - char *p = str; - unsigned int tot = 0; - - if (*p == '0') - { - p++; - if ((*p == 'x') || (*p == 'X')) - { - p++; - base = 16; - } - else - base = 8; - } - while (*p) - { - if ((*p >= '0') && (*p <= ((base == 8) ? '7' : '9'))) - { - tot = tot * base + (*p - '0'); - } - else if ((base == 16) && (*p >= 'a') && (*p <= 'f')) - { - tot = tot * base + 10 + (*p - 'a'); - } - else if ((base == 16) && (*p >= 'A') && (*p <= 'F')) - { - tot = tot * base + 10 + (*p - 'A'); - } - else - { - return tot; - } - p++; - } - return tot; -} - /* * xf86getNextLine -- * @@ -434,7 +387,7 @@ again: configRBuf[i++] = c; configPos--; /* GJA -- one too far */ configRBuf[i] = '\0'; - val.num = xf86strToUL (configRBuf); + val.num = strtoul (configRBuf, NULL, 0); val.realnum = atof (configRBuf); return NUMBER; } |