From b13f92b9e9cb463c69cbe32c7b0e783aed03926e Mon Sep 17 00:00:00 2001 From: Dave Beckett Date: Sun, 10 Oct 2021 00:36:58 -0700 Subject: Remove ancient protection around ctype calls The isTHING() calls do not need an isascii() wrapper ever. --- src/parsedate.y | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/src/parsedate.y b/src/parsedate.y index b0b5197e..77f5d4f6 100644 --- a/src/parsedate.y +++ b/src/parsedate.y @@ -49,25 +49,7 @@ #include "raptor2.h" #include "raptor_internal.h" -#if !defined(isascii) && !defined(HAVE_ISASCII) -# define IN_CTYPE_DOMAIN(c) 1 -#else -# define IN_CTYPE_DOMAIN(c) isascii(c) -#endif -#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c)) -#define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (c)) -#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (c)) -#define ISDIGIT_LOCALE(c) (IN_CTYPE_DOMAIN (c) && isdigit (c)) - -/* ISDIGIT differs from ISDIGIT_LOCALE, as follows: - - Its arg may be any int or unsigned int; it need not be an unsigned char. - - It's guaranteed to evaluate its argument exactly once. - - It's typically faster. - Posix 1003.2-1992 section 2.5.2.1 page 50 lines 1556-1558 says that - only '0' through '9' are digits. Prefer ISDIGIT to ISDIGIT_LOCALE unless - it's important to use the locale's definition of `digit' even when the - host does not conform to Posix. */ #define ISDIGIT(c) ((unsigned) (c) - '0' <= 9) #ifdef HAVE_STRING_H @@ -858,7 +840,7 @@ LookupWord (YYSTYPE *lvalp, char *buff) /* Make it lowercase. */ for(p = buff; *p; p++) - if(ISUPPER ((unsigned char) *p)) + if(isupper ((unsigned char) *p)) *p = tolower (*p); if(strcmp (buff, "am") == 0 || strcmp (buff, "a.m.") == 0) @@ -939,7 +921,7 @@ LookupWord (YYSTYPE *lvalp, char *buff) } /* Military timezones. */ - if(buff[1] == '\0' && ISALPHA ((unsigned char) *buff)) + if(buff[1] == '\0' && isalpha ((unsigned char) *buff)) { for(tp = MilitaryTable; tp->name; tp++) if(strcmp (buff, tp->name) == 0) @@ -978,10 +960,10 @@ int yylex(YYSTYPE *lvalp, void *parm) for(;;) { - while(ISSPACE ((unsigned char) *date->yyInput)) + while(isspace ((unsigned char) *date->yyInput)) date->yyInput++; - if(ISDIGIT (c = *date->yyInput) || c == '-' || c == '+') + if(isdigit (c = *date->yyInput) || c == '-' || c == '+') { if(c == '-' || c == '+') { @@ -1009,9 +991,9 @@ int yylex(YYSTYPE *lvalp, void *parm) } return sign ? tSNUMBER : tUNUMBER; } - if(ISALPHA (c)) + if(isalpha (c)) { - for(p = buff; (c = *date->yyInput++, ISALPHA (c)) || c == '.';) + for(p = buff; (c = *date->yyInput++, isalpha (c)) || c == '.';) if(p < &buff[sizeof buff - 1]) *p++ = c; *p = '\0'; -- cgit v1.2.1