OSDN Git Service

* tradcif.y (parse_number): Use TOLOWER/ISXDIGIT/hex_value/hex_p.
authorghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 10 Nov 2001 04:52:13 +0000 (04:52 +0000)
committerghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 10 Nov 2001 04:52:13 +0000 (04:52 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@46913 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/tradcif.y

index 86b64a7..7fb7850 100644 (file)
@@ -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'.
 
index 7cedecc..baafad1 100644 (file)
@@ -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)--;