httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yann Ylavic <ylavic....@gmail.com>
Subject Re: svn commit: r1715401 - in /httpd/httpd/trunk: include/ap_mmn.h include/httpd.h server/util.c
Date Fri, 20 Nov 2015 22:17:56 GMT
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