changes to zdump.c and zic.c invocations of is.* macros
Paul Eggert
eggert at CS.UCLA.EDU
Tue Dec 6 21:38:15 UTC 2005
Arthur David Olson <olsona at elsie.nci.nih.gov> writes:
> ! if (isascii((unsigned char) *cp) &&
> ! isdigit((unsigned char) *cp))
> ! if (*cp++ == '1' &&
> ! *cp >= '0' && *cp <= '4')
> ! ++cp;
Here's something that's a bit shorter, and perhaps simpler.
if ('0' <= *cp && *cp <= '9' && *cp++ == '1' && '0' <= *cp && *cp <= '4')
++cp;
The C Standard guarantees that isdigit (ch) is equivalent to '0' <= ch
&& ch <= '9', and I don't know of any C implementation where that's
not true.
The above simplification could be done in two separate parts of the patch.
More information about the tz
mailing list