]> git.ipfire.org Git - thirdparty/shadow.git/commit
Use isdigit(3) instead of a reimplementation of it 481/head
authorAlejandro Colomar <alx.manpages@gmail.com>
Tue, 28 Dec 2021 18:55:09 +0000 (19:55 +0100)
committerAlejandro Colomar <alx.manpages@gmail.com>
Wed, 29 Dec 2021 01:41:09 +0000 (02:41 +0100)
commit8f134c0beab0cb6cc2fb2e662516e54e8177fa87
treeaa8b7998733fdefcac9d13cdf34e28f1bba60849
parent44126d85ee9a33d10e24da1a8b901f8145918d95
Use isdigit(3) instead of a reimplementation of it

C89 defined isdigit as a function that tests for any decimal-digit
character, defining the decimal digits as 0 1 2 3 4 5 6 7 8 9.

I don't own a copy of C89 to check, but check in C17:

7.4.1.5
5.2.1

More specifically:

> In both the source and execution basic character sets, the value
> of each character after 0 in the above list of decimal digits
> shall be one greater than the value of the previous.

And since in ascii(7), the character after '9' is ':', it's highly
unlikely that any implementation will ever accept any
_decimal digit_ other than 0..9.

POSIX simply defers to the ISO C standard.

This is exactly what we wanted from ISDIGIT(c), so just use it.
Non-standard implementations might have been slower or considered
other characters as digits in the past, but let's assume
implementations available today conform to ISO C89.

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