diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2015-02-09 13:04:00 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2015-02-09 13:04:00 +0000 |
commit | ae56d15b089c2097d43916553b300243a6661def (patch) | |
tree | 59da104df3defc2e3a2f82912b9134db212caedd /lib/libc | |
parent | 02f944c53baa0940ebbdd11c7da5516218a39598 (diff) |
replace homegrown is_digit with correct calls to isdigit()
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/time/localtime.c | 12 | ||||
-rw-r--r-- | lib/libc/time/private.h | 5 |
2 files changed, 7 insertions, 10 deletions
diff --git a/lib/libc/time/localtime.c b/lib/libc/time/localtime.c index 9098773c73d..3caef71665b 100644 --- a/lib/libc/time/localtime.c +++ b/lib/libc/time/localtime.c @@ -1,4 +1,4 @@ -/* $OpenBSD: localtime.c,v 1.39 2015/02/09 08:25:11 tedu Exp $ */ +/* $OpenBSD: localtime.c,v 1.40 2015/02/09 13:03:59 tedu Exp $ */ /* ** This file is in the public domain, so clarified as of ** 1996-06-05 by Arthur David Olson. @@ -9,7 +9,7 @@ ** POSIX-style TZ environment variable handling from Guy Harris. */ -/*LINTLIBRARY*/ +#include <ctype.h> #include "private.h" #include "tzfile.h" @@ -624,7 +624,7 @@ register const char * strp; { register char c; - while ((c = *strp) != '\0' && !is_digit(c) && c != ',' && c != '-' && + while ((c = *strp) != '\0' && !isdigit((unsigned char)c) && c != ',' && c != '-' && c != '+') ++strp; return strp; @@ -666,7 +666,7 @@ const int max; register char c; register int num; - if (strp == NULL || !is_digit(c = *strp)) + if (strp == NULL || !isdigit((unsigned char)(c = *strp))) return NULL; num = 0; do { @@ -674,7 +674,7 @@ const int max; if (num > max) return NULL; /* illegal value */ c = *++strp; - } while (is_digit(c)); + } while (isdigit((unsigned char)c)); if (num < min) return NULL; /* illegal value */ *nump = num; @@ -787,7 +787,7 @@ register struct rule * const rulep; if (*strp++ != '.') return NULL; strp = getnum(strp, &rulep->r_day, 0, DAYSPERWEEK - 1); - } else if (is_digit(*strp)) { + } else if (isdigit((unsigned char)*strp)) { /* ** Day of year. */ diff --git a/lib/libc/time/private.h b/lib/libc/time/private.h index b1ddbff1248..d855b961a6d 100644 --- a/lib/libc/time/private.h +++ b/lib/libc/time/private.h @@ -1,4 +1,4 @@ -/* $OpenBSD: private.h,v 1.28 2015/02/09 11:29:19 tedu Exp $ */ +/* $OpenBSD: private.h,v 1.29 2015/02/09 13:03:59 tedu Exp $ */ #ifndef PRIVATE_H #define PRIVATE_H @@ -113,9 +113,6 @@ #define R_OK 4 #endif /* !defined R_OK */ -/* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX. */ -#define is_digit(c) ((unsigned)(c) - '0' <= 9) - #include "stdint.h" #ifndef INT_FAST64_MAX |