Return-Path: Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 55281 invoked by uid 500); 6 May 2002 09:11:53 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 55270 invoked by uid 500); 6 May 2002 09:11:53 -0000 Delivered-To: apmail-httpd-2.0-cvs@apache.org Date: 6 May 2002 09:11:51 -0000 Message-ID: <20020506091151.25111.qmail@icarus.apache.org> From: jwoolley@apache.org To: httpd-2.0-cvs@apache.org Subject: cvs commit: httpd-2.0/server protocol.c X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N jwoolley 02/05/06 02:11:51 Modified: server protocol.c Log: 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. Revision Changes Path 1.98 +4 -12 httpd-2.0/server/protocol.c Index: protocol.c =================================================================== RCS file: /home/cvs/httpd-2.0/server/protocol.c,v retrieving revision 1.97 retrieving revision 1.98 diff -u -d -u -r1.97 -r1.98 --- protocol.c 28 Apr 2002 06:24:53 -0000 1.97 +++ protocol.c 6 May 2002 09:11:50 -0000 1.98 @@ -1133,6 +1133,7 @@ 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 @@ 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_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);