]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
Remove definition of ISDIGIT_LOCALE(c)
authorAlejandro Colomar <alx.manpages@gmail.com>
Tue, 28 Dec 2021 18:38:58 +0000 (19:38 +0100)
committerAlejandro Colomar <alx.manpages@gmail.com>
Wed, 29 Dec 2021 01:41:09 +0000 (02:41 +0100)
It wasn't being used at all.  Let's remove it.

Use isdigit(3) directly in comments that referenced it.

Also, in those comments, remove an outdated reference to the fact
that ISDIGIT_LOCALE(c) might evaluate its argument more than once,
which could be true a few commits ago, until
IN_CTYPE_DEFINITION(c) was removed.  Previously, the definition
for ISDIGIT_LOCALE(c) was:

 #if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
 # define IN_CTYPE_DOMAIN(c) 1
 #else
 # define IN_CTYPE_DOMAIN(c) isascii(c)
 #endif

 #define ISDIGIT_LOCALE(c) (IN_CTYPE_DOMAIN (c) && isdigit (c))

Which could evaluate 'c' twice on pre-C89 systems (which I hope
don't exist nowadays).

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
lib/defines.h
libmisc/getdate.y

index 6b1bb3cb0ff2a27e03d191210d212ce14aa29a9e..316cce5a009ae27dcefe91f301a8a762a1142c5c 100644 (file)
@@ -22,8 +22,6 @@ typedef unsigned char _Bool;
 # define __bool_true_false_are_defined 1
 #endif
 
-#define ISDIGIT_LOCALE(c) isdigit (c)
-
 /* Take care of NLS matters.  */
 #ifdef S_SPLINT_S
 extern char *setlocale(int categories, const char *locale);
index 4d282edc893633051a65c8fdd94151e8c33fcfda..82f1369cb70f8e076553dd51bdb1865698764c35 100644 (file)
 #include <ctype.h>
 #include <time.h>
 
-#define ISDIGIT_LOCALE(c) isdigit (c)
-
-/* ISDIGIT differs from ISDIGIT_LOCALE, as follows:
+/* ISDIGIT differs from isdigit(3), 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
+   only '0' through '9' are digits.  Prefer ISDIGIT to isdigit(3) 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)