diff options
author | DJ Delorie <dj@delorie.com> | 2000-12-08 16:37:01 +0000 |
---|---|---|
committer | DJ Delorie <dj@delorie.com> | 2000-12-08 16:37:01 +0000 |
commit | c80b37e06fa86abffeffb96298e8a878e99987fa (patch) | |
tree | ca1559f5ccad71fef7ababa2511b1ba212bf9005 /libiberty/strtol.c | |
parent | 4c40214ce33db2051ae315a4bb100081bd05b767 (diff) | |
download | binutils-redhat-c80b37e06fa86abffeffb96298e8a878e99987fa.tar.gz |
* safe-ctype.c: New file.
* Makefile.in (CFILES): Add safe-ctype.c.
(REQUIRED_OFILES): Add safe-ctype.o.
* argv.c: Define ISBLANK and use it, not isspace.
* basename.c, cplus-dem.c, fnmatch.c, pexecute.c, strtod.c,
strtol.c, strtoul.c: Include safe-ctype.h, not ctype.h. Use
uppercase ctype macros. Don't test ISUPPER(c)/ISLOWER(c)
before calling TOLOWER(c)/TOUPPER(c).
Diffstat (limited to 'libiberty/strtol.c')
-rw-r--r-- | libiberty/strtol.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/libiberty/strtol.c b/libiberty/strtol.c index c05d0dd76a..7095c7254b 100644 --- a/libiberty/strtol.c +++ b/libiberty/strtol.c @@ -37,15 +37,11 @@ #ifdef HAVE_SYS_PARAM_H #include <sys/param.h> #endif -#include <ctype.h> #include <errno.h> #ifdef NEED_DECLARATION_ERRNO extern int errno; #endif -#if 0 -#include <stdlib.h> -#endif -#include "ansidecl.h" +#include "safe-ctype.h" /* FIXME: It'd be nice to configure around these, but the include files are too painful. These macros should at least be more portable than hardwired hex @@ -88,7 +84,7 @@ strtol(nptr, endptr, base) */ do { c = *s++; - } while (isspace(c)); + } while (ISSPACE(c)); if (c == '-') { neg = 1; c = *s++; @@ -124,10 +120,10 @@ strtol(nptr, endptr, base) cutlim = cutoff % (unsigned long)base; cutoff /= (unsigned long)base; for (acc = 0, any = 0;; c = *s++) { - if (isdigit(c)) + if (ISDIGIT(c)) c -= '0'; - else if (isalpha(c)) - c -= isupper(c) ? 'A' - 10 : 'a' - 10; + else if (ISALPHA(c)) + c -= ISUPPER(c) ? 'A' - 10 : 'a' - 10; else break; if (c >= base) |