]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
* Optimize performance by moving calculation of loop invariant out of the loop
authorRuediger Pluem <rpluem@apache.org>
Fri, 8 Oct 2021 09:02:30 +0000 (09:02 +0000)
committerRuediger Pluem <rpluem@apache.org>
Fri, 8 Oct 2021 09:02:30 +0000 (09:02 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1894021 13f79535-47bb-0310-9956-ffa450edef68

server/util.c

index 6d0b67a3ed8044de6bf9459999ad0fb240e010a6..d3f3ac63c062cda0be0a748046d0b190cd7a32b5 100644 (file)
@@ -505,6 +505,7 @@ AP_DECLARE(int) ap_normalize_path(char *path, unsigned int flags)
     int ret = 1;
     apr_size_t l = 1, w = 1, n;
     int decode_unreserved = (flags & AP_NORMALIZE_DECODE_UNRESERVED) != 0;
+    int merge_slashes = (flags & AP_NORMALIZE_MERGE_SLASHES) != 0;
 
     if (!IS_SLASH(path[0])) {
         /* Besides "OPTIONS *", a request-target should start with '/'
@@ -549,7 +550,7 @@ AP_DECLARE(int) ap_normalize_path(char *path, unsigned int flags)
 
         if (w == 0 || IS_SLASH(path[w - 1])) {
             /* Collapse ///// sequences to / */
-            if ((flags & AP_NORMALIZE_MERGE_SLASHES) && IS_SLASH(path[l])) {
+            if (merge_slashes && IS_SLASH(path[l])) {
                 do {
                     l++;
                 } while (IS_SLASH(path[l]));