Use standard isspace(3), isalpha(3), and isupper(3)
Due to the recent removal of IN_CTYPE_DOMAIN(), the uppercase macros that wrapped these standard calls are now defined to be equivalent. Therefore, there's no need for the wrappers, and it is much more readable to use the standard calls directly. However, hold on with ISDIGIT*(), since it's not so obvious what to do with it. Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
This commit is contained in:
parent
45d2e6dff0
commit
2a41a72b8c
@ -31,9 +31,6 @@
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
|
||||
#define ISSPACE(c) isspace (c)
|
||||
#define ISALPHA(c) isalpha (c)
|
||||
#define ISUPPER(c) isupper (c)
|
||||
#define ISDIGIT_LOCALE(c) isdigit (c)
|
||||
|
||||
/* ISDIGIT differs from ISDIGIT_LOCALE, as follows:
|
||||
@ -643,7 +640,7 @@ static int LookupWord (char *buff)
|
||||
|
||||
/* Make it lowercase. */
|
||||
for (p = buff; '\0' != *p; p++)
|
||||
if (ISUPPER (*p))
|
||||
if (isupper (*p))
|
||||
*p = tolower (*p);
|
||||
|
||||
if (strcmp (buff, "am") == 0 || strcmp (buff, "a.m.") == 0)
|
||||
@ -724,7 +721,7 @@ static int LookupWord (char *buff)
|
||||
}
|
||||
|
||||
/* Military timezones. */
|
||||
if (buff[1] == '\0' && ISALPHA (*buff))
|
||||
if (buff[1] == '\0' && isalpha (*buff))
|
||||
{
|
||||
for (tp = MilitaryTable; tp->name; tp++)
|
||||
if (strcmp (buff, tp->name) == 0)
|
||||
@ -763,7 +760,7 @@ yylex (void)
|
||||
|
||||
for (;;)
|
||||
{
|
||||
while (ISSPACE (*yyInput))
|
||||
while (isspace (*yyInput))
|
||||
yyInput++;
|
||||
|
||||
if (ISDIGIT (c = *yyInput) || c == '-' || c == '+')
|
||||
@ -784,9 +781,9 @@ yylex (void)
|
||||
yylval.Number = -yylval.Number;
|
||||
return (0 != sign) ? tSNUMBER : tUNUMBER;
|
||||
}
|
||||
if (ISALPHA (c))
|
||||
if (isalpha (c))
|
||||
{
|
||||
for (p = buff; (c = *yyInput++, ISALPHA (c)) || c == '.';)
|
||||
for (p = buff; (c = *yyInput++, isalpha (c)) || c == '.';)
|
||||
if (p < &buff[sizeof buff - 1])
|
||||
*p++ = c;
|
||||
*p = '\0';
|
||||
|
Loading…
Reference in New Issue
Block a user