]> granicus.if.org Git - apache/commitdiff
don't compute the strlen of dconf->directory three times
authorAndré Malo <nd@apache.org>
Wed, 23 Jul 2003 13:32:14 +0000 (13:32 +0000)
committerAndré Malo <nd@apache.org>
Wed, 23 Jul 2003 13:32:14 +0000 (13:32 +0000)
Submitted by: Justin

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

modules/mappers/mod_rewrite.c

index 7e2ac2d851279722ed89edb1558782b449842606..88f951db5cfcdfd30ecdeeeb93be7cd60c2f4c39 100644 (file)
@@ -1449,7 +1449,7 @@ static int hook_fixup(request_rec *r)
     char *cp2;
     const char *ccp;
     char *prefix;
-    int l;
+    apr_size_t l;
     int rulestatus;
     int n;
     char *ofilename;
@@ -1478,10 +1478,10 @@ static int hook_fixup(request_rec *r)
      *  URL: http://localhost/foo  and .htaccess is located in foo directory
      *  Ignore such attempts, since they may lead to undefined behaviour.
      */
-    if (r->filename &&
-        strlen(r->filename) == strlen(dconf->directory) - 1 &&
-        (dconf->directory)[strlen(dconf->directory) - 1] == '/' &&
-        !strncmp(r->filename, dconf->directory, strlen(dconf->directory) - 1)) {
+    l = strlen(dconf->directory) - 1;
+    if (r->filename && strlen(r->filename) == l &&
+        (dconf->directory)[l] == '/' &&
+        !strncmp(r->filename, dconf->directory, l)) {
         return DECLINED;
     }