[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Patch:] restore the native use of isdigit() instead of ap_isdigit() in httpd.
- To: tech_(_at_)_openbsd_(_dot_)_org
- Subject: Re: [Patch:] restore the native use of isdigit() instead of ap_isdigit() in httpd.
- From: Daniel Ouellet <daniel_(_at_)_presscom_(_dot_)_net>
- Date: Thu, 30 Mar 2006 23:24:05 -0500
Following strong advise, I am redoing this slower and much more
carefully with the justification as well included.
Only doing one file at a time, this round.
Hopefully this will be more welcome and useful.
Changes affected needs casts as none are (unsigned char) already.
All define in include/httpd.h as the following
struct request_rec {
...
const char *range;
char *protocol;
const char *status_line;
...
}
So, new patch included.
Thanks.
Daniel
PS: I also change the spacing on the line I was working as well to make
it KNF.
================================
Index: http_protocol.c
===================================================================
RCS file: /cvs/src/usr.sbin/httpd/src/main/http_protocol.c,v
retrieving revision 1.30
diff -u -r1.30 http_protocol.c
--- http_protocol.c 11 Feb 2006 19:15:57 -0000 1.30
+++ http_protocol.c 31 Mar 2006 04:11:16 -0000
@@ -154,7 +154,7 @@
return BYTERANGE_EMPTY;
}
- if (ap_isdigit(*r->range))
+ if (isdigit((unsigned char)*r->range))
*start = ap_strtol(r->range, (char **)&r->range, 10);
else
*start = -1;
@@ -169,7 +169,7 @@
while (ap_isspace(*r->range))
++r->range;
- if (ap_isdigit(*r->range))
+ if (isdigit((unsigned char)*r->range))
*end = ap_strtol(r->range, (char **)&r->range, 10);
else
*end = -1;
@@ -1011,9 +1011,9 @@
/* Avoid sscanf in the common case */
if (strlen(r->protocol) == 8
&& r->protocol[0] == 'H' && r->protocol[1] == 'T'
- && r->protocol[2] == 'T' && r->protocol[3] == 'P'
- && r->protocol[4] == '/' && ap_isdigit(r->protocol[5])
- && r->protocol[6] == '.' && ap_isdigit(r->protocol[7])) {
+ && r->protocol[2] == 'T' && r->protocol[3] == 'P'
+ && r->protocol[4] == '/' && isdigit((unsigned char)r->protocol[5])
+ && r->protocol[6] == '.' && isdigit((unsigned
char)r->protocol[7])) {
r->proto_num = HTTP_VERSION(r->protocol[5] - '0',
r->protocol[7] - '0');
}
else {
@@ -2768,9 +2768,9 @@
*/
if (r->status_line != NULL
&& strlen(r->status_line) > 4 /* long enough */
- && ap_isdigit(r->status_line[0])
- && ap_isdigit(r->status_line[1])
- && ap_isdigit(r->status_line[2])
+ && isdigit((unsigned char)r->status_line[0])
+ && isdigit((unsigned char)r->status_line[1])
+ && isdigit((unsigned char)r->status_line[2])
&& ap_isspace(r->status_line[3])
&& ap_isalnum(r->status_line[4])) {
title = r->status_line;
Visit your host, monkey.org