From: Cliff Woolley Date: Mon, 6 May 2002 09:11:50 +0000 (+0000) Subject: cleanup old-school backward uses of APR_BRIGADE_CONCAT to use X-Git-Tag: 2.0.37~496 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f37d50cd714cc043196fa84e7f799f61402ae0fc;p=apache cleanup old-school backward uses of APR_BRIGADE_CONCAT to use APR_BRIGADE_PREPEND instead, plus optimize away a bunch of repetitive brigade destructions/creations by hanging onto ctx->saved even after we empty it out. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94952 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/protocol.c b/server/protocol.c index d46c6677e3..8ba3e65dfc 100644 --- a/server/protocol.c +++ b/server/protocol.c @@ -1133,6 +1133,7 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_content_length_filter(ap_filter_t *f, if (!ctx) { /* first time through */ f->ctx = ctx = apr_pcalloc(r->pool, sizeof(struct content_length_ctx)); ctx->compute_len = 1; /* Assume we will compute the length */ + ctx->saved = apr_brigade_create(r->pool, f->c->bucket_alloc); } /* Humm, is this check the best it can be? @@ -1217,12 +1218,8 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_content_length_filter(ap_filter_t *f, if (split) { ctx->compute_len = 0; /* Ooops, can't compute the length now */ ctx->curr_len = 0; - if (ctx->saved) { - APR_BRIGADE_CONCAT(ctx->saved, split); - apr_brigade_destroy(split); - split = ctx->saved; - ctx->saved = NULL; - } + + APR_BRIGADE_PREPEND(split, ctx->saved); if (flush) { rv = ap_fflush(f->next, split); @@ -1252,12 +1249,7 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_content_length_filter(ap_filter_t *f, ap_set_content_length(r, r->bytes_sent); } - if (ctx->saved) { - APR_BRIGADE_CONCAT(ctx->saved, b); - apr_brigade_destroy(b); - b = ctx->saved; - ctx->saved = NULL; - } + APR_BRIGADE_PREPEND(b, ctx->saved); ctx->curr_len = 0; return ap_pass_brigade(f->next, b);