From: Yann Ylavic Date: Tue, 29 Dec 2015 17:13:15 +0000 (+0000) Subject: Small changes to ap_casecmpstr[n]() for better performances, see: X-Git-Tag: 2.5.0-alpha~2486 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8d901360093ed9a240d8f73084869a89b6185137;p=thirdparty%2Fapache%2Fhttpd.git Small changes to ap_casecmpstr[n]() for better performances, see: http://mail-archives.apache.org/mod_mbox/httpd-dev/201511.mbox/%3CCAKQ1sVOU7xmY-_PaQb0et0GXO-NxtTPBsD4ZU_UbtUzWYOUVTg%40mail.gmail.com%3E git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1722194 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/util.c b/server/util.c index b69df08c60e..62299f7c303 100644 --- a/server/util.c +++ b/server/util.c @@ -3264,12 +3264,13 @@ AP_DECLARE(int) ap_casecmpstr(const char *s1, const char *s2) const unsigned char *ps1 = (const unsigned char *) s1; const unsigned char *ps2 = (const unsigned char *) s2; - while (ucharmap[*ps1] == ucharmap[*ps2++]) { + while (ucharmap[*ps1] == ucharmap[*ps2]) { if (*ps1++ == '\0') { return (0); } + ps2++; } - return (ucharmap[*ps1] - ucharmap[*--ps2]); + return (ucharmap[*ps1] - ucharmap[*ps2]); } AP_DECLARE(int) ap_casecmpstrn(const char *s1, const char *s2, apr_size_t n) @@ -3277,12 +3278,13 @@ AP_DECLARE(int) ap_casecmpstrn(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; while (n--) { - if (ucharmap[*ps1] != ucharmap[*ps2++]) { - return (ucharmap[*ps1] - ucharmap[*--ps2]); + if (ucharmap[*ps1] != ucharmap[*ps2]) { + return (ucharmap[*ps1] - ucharmap[*ps2]); } if (*ps1++ == '\0') { break; } + ps2++; } return (0); }