]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
Use standard isspace(3), isalpha(3), and isupper(3)
authorAlejandro Colomar <alx.manpages@gmail.com>
Tue, 28 Dec 2021 18:33:23 +0000 (19:33 +0100)
committerAlejandro Colomar <alx.manpages@gmail.com>
Wed, 29 Dec 2021 01:41:09 +0000 (02:41 +0100)
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>
libmisc/getdate.y

index ce2235fd24760bd2bfd6d8823984f07b897fcd1a..4d282edc893633051a65c8fdd94151e8c33fcfda 100644 (file)
@@ -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';