]> granicus.if.org Git - apache/commitdiff
Follow up to r1609680: simpler/faster ap_proxy_strcmp_ematch().
authorYann Ylavic <ylavic@apache.org>
Thu, 8 Mar 2018 23:23:30 +0000 (23:23 +0000)
committerYann Ylavic <ylavic@apache.org>
Thu, 8 Mar 2018 23:23:30 +0000 (23:23 +0000)
No functional change.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1826289 13f79535-47bb-0310-9956-ffa450edef68

modules/proxy/proxy_util.c

index f2ea34d8af72b9643dafa91b7fccc73f78c082af..0a88c5bac74b9dcf5e0b8ea70521452994a5af41 100644 (file)
@@ -1502,11 +1502,13 @@ static int ap_proxy_strcmp_ematch(const char *str, const char *expected)
     apr_size_t x, y;
 
     for (x = 0, y = 0; expected[y]; ++y, ++x) {
-        if ((!str[x]) && (expected[y] != '$' || !apr_isdigit(expected[y + 1])))
+        int backref = (expected[y] == '$' && apr_isdigit(expected[y + 1]));
+        if (!str[x] && !backref)
             return -1;
-        if (expected[y] == '$' && apr_isdigit(expected[y + 1])) {
-            while (expected[y] == '$' && apr_isdigit(expected[y + 1]))
+        if (backref) {
+            do {
                 y += 2;
+            } while (expected[y] == '$' && apr_isdigit(expected[y + 1]));
             if (!expected[y])
                 return 0;
             while (str[x]) {