aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>2001-11-10 04:52:13 +0000
committerKaveh Ghazi <ghazi@gcc.gnu.org>2001-11-10 04:52:13 +0000
commit57e9b915ec39eb42316a913136692e1529a2cc28 (patch)
tree5181b2a4524d9c657376847b456883e23739f526
parent9e1ac9154abc68bb0ebaf2b2585b0a204c616240 (diff)
downloadgcc-57e9b915ec39eb42316a913136692e1529a2cc28.zip
gcc-57e9b915ec39eb42316a913136692e1529a2cc28.tar.gz
gcc-57e9b915ec39eb42316a913136692e1529a2cc28.tar.bz2
* tradcif.y (parse_number): Use TOLOWER/ISXDIGIT/hex_value/hex_p.
From-SVN: r46913
-rw-r--r--gcc/ChangeLog1
-rw-r--r--gcc/tradcif.y21
2 files changed, 8 insertions, 14 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 86b64a7..7fb7850 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -3,6 +3,7 @@
* cppexp.c (parse_number): Use ISXDIGIT/hex_value.
* cpplex.c (hex_digit_value): Use hex_p/hex_value.
* cppmain.c (general_init): Call hex_init.
+ * tradcif.y (parse_number): Use TOLOWER/ISXDIGIT/hex_value/hex_p.
* config.gcc (i[34567]86-dg-dgux*): Don't set `out_file'.
diff --git a/gcc/tradcif.y b/gcc/tradcif.y
index 7cedecc..baafad1 100644
--- a/gcc/tradcif.y
+++ b/gcc/tradcif.y
@@ -248,14 +248,11 @@ parse_number (olen)
c = *p++;
len--;
if (ISUPPER (c))
- c += 'a' - 'A';
-
- if (ISDIGIT (c)) {
- n *= base;
- n += c - '0';
- } else if (base == 16 && c >= 'a' && c <= 'f') {
- n *= base;
- n += c - 'a' + 10;
+ c = TOLOWER (c);
+
+ if (ISDIGIT (c)
+ || (base == 16 && ISXDIGIT (c))) {
+ n = (n * base) + hex_value (c);
} else {
/* `l' means long, and `u' means unsigned. */
while (1) {
@@ -509,12 +506,8 @@ parse_escape (string_ptr)
for (;;)
{
c = *(*string_ptr)++;
- if (ISDIGIT (c))
- i = (i << 4) + c - '0';
- else if (c >= 'a' && c <= 'f')
- i = (i << 4) + c - 'a' + 10;
- else if (c >= 'A' && c <= 'F')
- i = (i << 4) + c - 'A' + 10;
+ if (hex_p (c))
+ i = (i << 4) + hex_value (c);
else
{
(*string_ptr)--;