From: Stefan Fritsch Date: Mon, 24 Oct 2011 11:20:28 +0000 (+0000) Subject: Make loop more efficient as pointed out by Roy X-Git-Tag: 2.3.15~97 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f7e2ea6e3a8c2b97d96bdb127fd19831a3a948f2;p=apache Make loop more efficient as pointed out by Roy git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1188094 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/filters/mod_filter.c b/modules/filters/mod_filter.c index dc1a4c79c3..936cc529a0 100644 --- a/modules/filters/mod_filter.c +++ b/modules/filters/mod_filter.c @@ -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; }