You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by jw...@apache.org on 2002/05/06 11:11:51 UTC

cvs commit: httpd-2.0/server protocol.c

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);