httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Jagielski <...@jaguNET.com>
Subject Re: svn commit: r1715401 - in /httpd/httpd/trunk: include/ap_mmn.h include/httpd.h server/util.c
Date Sat, 21 Nov 2015 13:54:57 GMT
I thought about that, but we don't have many do-whiles :)

But whatever people would prefer is fine w/ me...

> On Nov 20, 2015, at 5:29 PM, Yann Ylavic <ylavic.dev@gmail.com> wrote:
> 
> Alternatively, a single/simpler while (n--){} would work too.
> 
> 
> On Fri, Nov 20, 2015 at 11:17 PM, Yann Ylavic <ylavic.dev@gmail.com> wrote:
>> On Fri, Nov 20, 2015 at 7:49 PM,  <jim@apache.org> wrote:
>>> Author: jim
>>> Date: Fri Nov 20 18:49:38 2015
>>> New Revision: 1715401
>>> 
>>> URL: http://svn.apache.org/viewvc?rev=1715401&view=rev
>>> Log:
>>> Provide our own impl of str[n]casecmp()
>>> 
>>> This simply provides it. Next step is to change all uses of
>>> str[n]casecmp to ap_str[n]casecmp and *then* remove those silly
>>> logic paths where we check the 1st char of a string before
>>> we do the strcasecmp (since this is no longer expensive).
>>> 
>>> Modified:
>> []
>>>    httpd/httpd/trunk/server/util.c
>> []
>>> +AP_DECLARE(int) ap_strncasecmp(const char *s1, const char *s2, apr_size_t n)
>>> +{
>>> +    const unsigned char *ps1 = (const unsigned char *) s1;
>>> +    const unsigned char *ps2 = (const unsigned char *) s2;
>>> +    if (n) {
>>> +        do {
>>> +            if (ucharmap[*ps1] != ucharmap[*ps2++]) {
>>> +                return (ucharmap[*ps1] - ucharmap[*--ps2]);
>>> +            }
>>> +            if (*ps1++ == '\0') {
>>> +                /* we know both end here */
>>> +                return (0);
>>> +            }
>>> +        } while (!--n);
>> 
>> while (--n) probably.
>> 
>>> +    }
>>> +    return (0);
>>> +}
>>> 
>>> 


Mime
View raw message