]> granicus.if.org Git - apache/commitdiff
cleanup old-school backward uses of APR_BRIGADE_CONCAT to use
authorCliff Woolley <jwoolley@apache.org>
Mon, 6 May 2002 09:11:50 +0000 (09:11 +0000)
committerCliff Woolley <jwoolley@apache.org>
Mon, 6 May 2002 09:11:50 +0000 (09:11 +0000)
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

server/protocol.c

index d46c6677e347ede6c8b4514823830861d63d27fd..8ba3e65dfcf117c6212f32afc605734eba8efca3 100644 (file)
@@ -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);