On Tue, Apr 16, 2013 at 07:34:58PM +0000, Joerg Sonnenberger wrote: > Module Name: src > Committed By: joerg > Date: Tue Apr 16 19:34:58 UTC 2013 > > Modified Files: > src/common/lib/libc/stdlib: _strtol.h _strtoul.h > > Log Message: > Do not use isalpha here, since we explicitly only support the Portable > Character Set as base and in theory a locale could define a ASCII > control character as letter, resulting in negations. Also avoid isdigit > here to give the compiler a better chance of deciding whether an > unsigned compare or a jump table is a better option, both are very > likely better choices than the memory indirection.
There really ought to be a way of requesting the straight ASCII versions of the isxxxx functions even after a local has been set. A lot of code will use isalpha() to check for valid variable names (etc) and really doesn't want locale-specific alpha characters be valid. (Otherwise scripts become non-portable.) OTOH (unsigned)(ch - '0') <= 9 is probably the fastest isdigit() on any modern cpu. David -- David Laight: da...@l8s.co.uk