From: Brian Pane Date: Sun, 2 Dec 2001 18:44:06 +0000 (+0000) Subject: Added faster logic for decodehtml to handle the special case X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d962bfd40920298db9f25cc62caa0581c8396c61;p=apache Added faster logic for decodehtml to handle the special case where the string being decoded doesn't have any ampersands in it (e.g., because it's the value for an 'include virtual=...') git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92284 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/filters/mod_include.c b/modules/filters/mod_include.c index 5691826d83..98dac76886 100644 --- a/modules/filters/mod_include.c +++ b/modules/filters/mod_include.c @@ -688,7 +688,7 @@ static apr_status_t get_combined_directive (include_ctx_t *ctx, static void decodehtml(char *s) { int val, i, j; - char *p = s; + char *p; const char *ents; static const char * const entlist[MAXENTLEN + 1] = { @@ -708,7 +708,16 @@ egrave\350eacute\351igrave\354iacute\355ntilde\361ograve\362oacute\363\ otilde\365oslash\370ugrave\371uacute\372yacute\375" /* 6 */ }; - for (; *s != '\0'; s++, p++) { + /* Do a fast scan through the string until we find anything + * that needs more complicated handling + */ + for (; *s != '&'; s++) { + if (*s == '\0') { + return; + } + } + + for (p = s; *s != '\0'; s++, p++) { if (*s != '&') { *p = *s; continue;