Dec. 6, 2005
9:38 p.m.
Arthur David Olson <olsona@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.