From e0a86f790a73001bcec87b4900e37eecd0460de0 Mon Sep 17 00:00:00 2001 From: Brian Pane Date: Sun, 17 Mar 2002 06:04:33 +0000 Subject: [PATCH] Small performance improvement for find_end_sequence() git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93978 13f79535-47bb-0310-9956-ffa450edef68 --- modules/filters/mod_include.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/filters/mod_include.c b/modules/filters/mod_include.c index 25e63c8528..7ae98c2fea 100644 --- a/modules/filters/mod_include.c +++ b/modules/filters/mod_include.c @@ -523,6 +523,7 @@ static apr_bucket *find_end_sequence(apr_bucket *dptr, include_ctx_t *ctx, const char *c; const char *buf; const char *str = ctx->end_seq; + const char *start; do { apr_status_t rv = 0; @@ -580,6 +581,7 @@ static apr_bucket *find_end_sequence(apr_bucket *dptr, include_ctx_t *ctx, else { c = buf; } + start = c; while (c < buf + len) { if (*c == str[ctx->parse_pos]) { if (ctx->state != PARSE_TAIL) { @@ -595,9 +597,10 @@ static apr_bucket *find_end_sequence(apr_bucket *dptr, include_ctx_t *ctx, * end of the END_SEQUENCE is in the current bucket. * The beginning might be in a previous bucket. */ - ctx->bytes_parsed++; + c++; + ctx->bytes_parsed += (c - start); ctx->state = PARSED; - apr_bucket_split(dptr, c - buf + 1); + apr_bucket_split(dptr, c - buf); tmp_buck = APR_BUCKET_NEXT(dptr); return (tmp_buck); } @@ -659,8 +662,8 @@ static apr_bucket *find_end_sequence(apr_bucket *dptr, include_ctx_t *ctx, } } c++; - ctx->bytes_parsed++; } + ctx->bytes_parsed += (c - start); dptr = APR_BUCKET_NEXT(dptr); } while (dptr != APR_BRIGADE_SENTINEL(bb)); return NULL; -- 2.40.0