]> granicus.if.org Git - flex/commitdiff
Obsolete htoui() and otoui(); use strtoul().
authorExplorer09 <explorer09@gmail.com>
Mon, 10 Apr 2017 18:10:29 +0000 (02:10 +0800)
committerWill Estes <westes575@gmail.com>
Tue, 2 May 2017 19:14:25 +0000 (15:14 -0400)
No sense to keep these two function when libc's strtoul() can do the
same job, but better.

src/flexdef.h
src/misc.c

index dd643a78b41d6310d0dfb532406b741de64314da..9dac6542863f659a524a09ffda2e438c4e85dcd1 100644 (file)
@@ -845,9 +845,6 @@ extern void flexfatal(const char *);
     }while(0)
 #endif /* ! HAVE_DECL___func__ */
 
-/* Convert a hexadecimal digit string to an integer value. */
-extern unsigned int htoui(unsigned char[]);
-
 /* Report an error message formatted  */
 extern void lerr(const char *, ...)
 #if defined(__GNUC__) && __GNUC__ >= 3
@@ -884,9 +881,6 @@ extern int myctoi(const char *);
 /* Return character corresponding to escape sequence. */
 extern unsigned char myesc(unsigned char[]);
 
-/* Convert an octal digit string to an integer value. */
-extern unsigned int otoui(unsigned char[]);
-
 /* Output a (possibly-formatted) string to the generated scanner. */
 extern void out(const char *);
 extern void out_dec(const char *, int);
index e17b1a2e02e34f161ac849656c81fe8f13ace640..d5d6b89b7c44219b7f31b8513b139e23b0626e89 100644 (file)
@@ -306,18 +306,6 @@ void flexfatal (const char *msg)
 }
 
 
-/* htoui - convert a hexadecimal digit string to an unsigned integer value */
-
-unsigned int htoui (unsigned char str[])
-{
-       unsigned int result;
-
-       (void) sscanf ((char *) str, "%x", &result);
-
-       return result;
-}
-
-
 /* lerr - report an error message */
 
 void lerr (const char *msg, ...)
@@ -528,7 +516,7 @@ unsigned char myesc (unsigned char array[])
                        c = array[sptr];
                        array[sptr] = '\0';
 
-                       esc_char = (unsigned char) otoui (array + 1);
+                       esc_char = (unsigned char) strtoul (array + 1, NULL, 8);
 
                        array[sptr] = c;
 
@@ -550,7 +538,7 @@ unsigned char myesc (unsigned char array[])
                        c = array[sptr];
                        array[sptr] = '\0';
 
-                       esc_char = (unsigned char) htoui (array + 2);
+                       esc_char = (unsigned char) strtoul (array + 2, NULL, 16);
 
                        array[sptr] = c;
 
@@ -563,17 +551,6 @@ unsigned char myesc (unsigned char array[])
 }
 
 
-/* otoui - convert an octal digit string to an unsigned integer value */
-
-unsigned int otoui (unsigned char str[])
-{
-       unsigned int result;
-
-       (void) sscanf ((char *) str, "%o", &result);
-       return result;
-}
-
-
 /* out - various flavors of outputing a (possibly formatted) string for the
  *      generated scanner, keeping track of the line count.
  */