Alternatively, a single/simpler while (n--){} would work too.

On Fri, Nov 20, 2015 at 11:17 PM, Yann Ylavic <[email protected]> wrote:
> On Fri, Nov 20, 2015 at 7:49 PM,  <[email protected]> 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);
>> +}
>>
>>

Reply via email to