diff options
author | Explorer09 <explorer09@gmail.com> | 2017-04-11 02:10:29 +0800 |
---|---|---|
committer | Will Estes <westes575@gmail.com> | 2017-05-02 15:14:25 -0400 |
commit | d4ab90f185e18328b834cb80886b5be15f1019fe (patch) | |
tree | 25b02b7ea67a25274888e5a7de488731660df5b5 /src/misc.c | |
parent | 09697fb269501dc0f3467e77bd4297d785c72aa8 (diff) |
Obsolete htoui() and otoui(); use strtoul().
No sense to keep these two function when libc's strtoul() can do the
same job, but better.
Diffstat (limited to 'src/misc.c')
-rw-r--r-- | src/misc.c | 27 |
1 files changed, 2 insertions, 25 deletions
@@ -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. */ |