]> granicus.if.org Git - apache/commitdiff
Make loop more efficient as pointed out by Roy
authorStefan Fritsch <sf@apache.org>
Mon, 24 Oct 2011 11:20:28 +0000 (11:20 +0000)
committerStefan Fritsch <sf@apache.org>
Mon, 24 Oct 2011 11:20:28 +0000 (11:20 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1188094 13f79535-47bb-0310-9956-ffa450edef68

modules/filters/mod_filter.c

index dc1a4c79c33b7993271c94590d883af585fcfeb4..936cc529a06a0d3a8fd5ddb811c3514ba166d10e 100644 (file)
@@ -162,12 +162,12 @@ static int filter_lookup(ap_filter_t *f, ap_filter_rec_t *filter)
         }
         else if (r->content_type) {
             const char **type = provider->types;
+            size_t len = strcspn(r->content_type, "; \t");
             AP_DEBUG_ASSERT(type != NULL);
             while (*type) {
                 /* Handle 'content-type;charset=...' correctly */
-                size_t len = strcspn(r->content_type, "; \t");
-                if (strlen(*type) == len
-                    && strncmp(*type, r->content_type, len) == 0) {
+                if (strncmp(*type, r->content_type, len) == 0
+                    && (*type)[len] == '\0') {
                     match = 1;
                     break;
                 }