|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
Re: [Patch:] restore the native use of isdigit() instead of ap_isdigit() in httpd.
From: Ted Unangst (ted.unangst
gmail.com)
Date: Fri Mar 31 2006 - 13:33:54 CST
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 3/30/06, Garance A Drosihn <drosih
rpi.edu> wrote:
> The stupid thing in these routines is that the behavior is
> UNDEFINED for values outside the correct range. We would
> probably be doing ourselves (as programmers) a favor if we
> made it a major error to pass in any negative value other
> than the value for EOF. Many programmers have read the
> description of these routines, and never quite understood
> that these routines do *not* take a parameter of 'char'.
i've thought about making all invalid values false. while the current
openbsd implementation is safe, isdigit('1' + 256) returns true!
something like
int
isdigit(int c) {
return c == EOF ? 0 : c < CHAR_MIN ? 0 : c > UCHAR_MAX ? 0 :
((_ctype_ + 1)[(unsigned char)c] & _N));
}
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]