diff options
-rw-r--r-- | lib/libc/time/localtime.c | 12 | ||||
-rw-r--r-- | lib/libc/time/private.h | 5 | ||||
-rw-r--r-- | usr.sbin/zic/scheck.c | 16 |
3 files changed, 15 insertions, 18 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 diff --git a/usr.sbin/zic/scheck.c b/usr.sbin/zic/scheck.c index 268c2a38538..661cc9d448b 100644 --- a/usr.sbin/zic/scheck.c +++ b/usr.sbin/zic/scheck.c @@ -1,10 +1,10 @@ -/* $OpenBSD: scheck.c,v 1.1 2015/02/09 12:37:47 tedu Exp $ */ +/* $OpenBSD: scheck.c,v 1.2 2015/02/09 13:03:59 tedu Exp $ */ /* ** This file is in the public domain, so clarified as of ** 2006-07-17 by Arthur David Olson. */ -/*LINTLIBRARY*/ +#include <ctype.h> #include "private.h" @@ -13,11 +13,11 @@ scheck(string, format) const char * const string; const char * const format; { - register char * fbuf; - register const char * fp; - register char * tp; - register int c; - register const char * result; + char * fbuf; + const char * fp; + char * tp; + int c; + const char * result; char dummy; result = ""; @@ -38,7 +38,7 @@ const char * const format; *tp++ = '*'; if (*fp == '*') ++fp; - while (is_digit(*fp)) + while (isdigit((unsigned char)*fp)) *tp++ = *fp++; if (*fp == 'l' || *fp == 'h') *tp++ = *fp++; |