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 2001/02/26 00:08:53 UTC

cvs commit: httpd-2.0/modules/http http_core.c http_protocol.c http_request.c

jwoolley    01/02/25 15:08:53

  Modified:    modules/experimental mod_charset_lite.c
               modules/filters mod_include.c
               modules/http http_core.c http_protocol.c http_request.c
  Log:
  Simplify by using apr_bucket_delete(e) where possible.
  
  (Oh, plus one tiny little loop simplification.)
  
  Revision  Changes    Path
  1.43      +3 -6      httpd-2.0/modules/experimental/mod_charset_lite.c
  
  Index: mod_charset_lite.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/experimental/mod_charset_lite.c,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -d -u -r1.42 -r1.43
  --- mod_charset_lite.c	2001/02/16 04:26:37	1.42
  +++ mod_charset_lite.c	2001/02/25 23:08:50	1.43
  @@ -743,8 +743,7 @@
       while (1) {
           if (!bucket_avail) { /* no bytes left to process in the current bucket... */
               if (consumed_bucket) {
  -                APR_BUCKET_REMOVE(consumed_bucket);
  -                apr_bucket_destroy(consumed_bucket);
  +                apr_bucket_delete(consumed_bucket);
                   consumed_bucket = NULL;
               }
               b = APR_BRIGADE_FIRST(bb);
  @@ -802,8 +801,7 @@
                   if (bucket_avail) {
                       apr_bucket_split(b, bytes_in_bucket - bucket_avail);
                   }
  -                APR_BUCKET_REMOVE(b);
  -                apr_bucket_destroy(b);
  +                apr_bucket_delete(b);
                   break;
               }
           }
  @@ -894,8 +892,7 @@
       while (!done) {
           if (!cur_len) { /* no bytes left to process in the current bucket... */
               if (consumed_bucket) {
  -                APR_BUCKET_REMOVE(consumed_bucket);
  -                apr_bucket_destroy(consumed_bucket);
  +                apr_bucket_delete(consumed_bucket);
                   consumed_bucket = NULL;
               }
               if (dptr == APR_BRIGADE_SENTINEL(bb)) {
  
  
  
  1.100     +8 -16     httpd-2.0/modules/filters/mod_include.c
  
  Index: mod_include.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/filters/mod_include.c,v
  retrieving revision 1.99
  retrieving revision 1.100
  diff -u -d -u -r1.99 -r1.100
  --- mod_include.c	2001/02/16 13:38:21	1.99
  +++ mod_include.c	2001/02/25 23:08:51	1.100
  @@ -2355,8 +2355,7 @@
   
                   while (!APR_BRIGADE_EMPTY(ctx->ssi_tag_brigade)) {
                       tmp_bkt = APR_BRIGADE_FIRST(ctx->ssi_tag_brigade);
  -                    APR_BUCKET_REMOVE(tmp_bkt);
  -                    apr_bucket_destroy(tmp_bkt);
  +                    apr_bucket_delete(tmp_bkt);
                   }
               }
   
  @@ -2370,8 +2369,7 @@
                       apr_bucket *free_bucket = dptr;
   
                       dptr = APR_BUCKET_NEXT (dptr);
  -                    APR_BUCKET_REMOVE(free_bucket);
  -                    apr_bucket_destroy(free_bucket);
  +                    apr_bucket_delete(free_bucket);
                   }
               }
   
  @@ -2445,16 +2443,14 @@
                   if (!APR_BRIGADE_EMPTY(ctx->ssi_tag_brigade)) {
                       while (!APR_BRIGADE_EMPTY(ctx->ssi_tag_brigade)) {
                           tmp_bkt = APR_BRIGADE_FIRST(ctx->ssi_tag_brigade);
  -                        APR_BUCKET_REMOVE(tmp_bkt);
  -                        apr_bucket_destroy(tmp_bkt);
  +                        apr_bucket_delete(tmp_bkt);
                       }
                   }
                   else {
                       do {
                           tmp_bkt  = tmp_dptr;
                           tmp_dptr = APR_BUCKET_NEXT (tmp_dptr);
  -                        APR_BUCKET_REMOVE(tmp_bkt);
  -                        apr_bucket_destroy(tmp_bkt);
  +                        apr_bucket_delete(tmp_bkt);
                       } while ((tmp_dptr != dptr) &&
                                (tmp_dptr != APR_BRIGADE_SENTINEL(*bb)));
                   }
  @@ -2525,16 +2521,14 @@
               if (!APR_BRIGADE_EMPTY(ctx->ssi_tag_brigade)) {
                   while (!APR_BRIGADE_EMPTY(ctx->ssi_tag_brigade)) {
                       tmp_bkt = APR_BRIGADE_FIRST(ctx->ssi_tag_brigade);
  -                    APR_BUCKET_REMOVE(tmp_bkt);
  -                    apr_bucket_destroy(tmp_bkt);
  +                    apr_bucket_delete(tmp_bkt);
                   }
               }
               else {
                   do {
                       tmp_bkt  = tmp_dptr;
                       tmp_dptr = APR_BUCKET_NEXT (tmp_dptr);
  -                    APR_BUCKET_REMOVE(tmp_bkt);
  -                    apr_bucket_destroy(tmp_bkt);
  +                    apr_bucket_delete(tmp_bkt);
                   } while ((tmp_dptr != content_head) &&
                            (tmp_dptr != APR_BRIGADE_SENTINEL(*bb)));
               }
  @@ -2558,8 +2552,7 @@
               if (!APR_BRIGADE_EMPTY(ctx->ssi_tag_brigade)) {
                   while (!APR_BRIGADE_EMPTY(ctx->ssi_tag_brigade)) {
                       tmp_bkt = APR_BRIGADE_FIRST(ctx->ssi_tag_brigade);
  -                    APR_BUCKET_REMOVE(tmp_bkt);
  -                    apr_bucket_destroy(tmp_bkt);
  +                    apr_bucket_delete(tmp_bkt);
                   }
               }
   
  @@ -2581,8 +2574,7 @@
               do {
                   free_bucket = dptr;
                   dptr = APR_BUCKET_NEXT (dptr);
  -                APR_BUCKET_REMOVE(free_bucket);
  -                apr_bucket_destroy(free_bucket);
  +                apr_bucket_delete(free_bucket);
               } while (dptr != APR_BRIGADE_SENTINEL(*bb));
           }
           else { /* Otherwise pass it along... */
  
  
  
  1.264     +1 -2      httpd-2.0/modules/http/http_core.c
  
  Index: http_core.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/http/http_core.c,v
  retrieving revision 1.263
  retrieving revision 1.264
  diff -u -d -u -r1.263 -r1.264
  --- http_core.c	2001/02/24 11:23:30	1.263
  +++ http_core.c	2001/02/25 23:08:52	1.264
  @@ -3289,8 +3289,7 @@
                * we want to process to second request fully.
                */
               if (APR_BUCKET_IS_EOS(e)) {
  -                APR_BUCKET_REMOVE(e);
  -                apr_bucket_destroy(e);
  +                apr_bucket_delete(e);
               }
               ap_save_brigade(f, &ctx->b, &b);
               return APR_SUCCESS;
  
  
  
  1.301     +9 -20     httpd-2.0/modules/http/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/http/http_protocol.c,v
  retrieving revision 1.300
  retrieving revision 1.301
  diff -u -d -u -r1.300 -r1.301
  --- http_protocol.c	2001/02/25 16:57:08	1.300
  +++ http_protocol.c	2001/02/25 23:08:52	1.301
  @@ -890,8 +890,7 @@
           }
           if (ctx->bytes_delivered == ctx->chunk_size) {
               AP_DEBUG_ASSERT(APR_BUCKET_IS_EOS(b));
  -            APR_BUCKET_REMOVE(b);
  -            apr_bucket_destroy(b);
  +            apr_bucket_delete(b);
               ctx->state = WANT_TRL;
           }
       }
  @@ -954,8 +953,7 @@
                           c += 2;
                       else return APR_SUCCESS;
                   }
  -                APR_BUCKET_REMOVE(e);
  -                apr_bucket_destroy(e);
  +                apr_bucket_delete(e);
               }
           }
       }
  @@ -967,11 +965,10 @@
       }
   
       if (f->c->remain) {
  -        e = APR_BRIGADE_FIRST(ctx->b);
  -        while (e != APR_BRIGADE_SENTINEL(ctx->b)) {
  -            apr_bucket *old;
  +        while (!APR_BRIGADE_EMPTY(ctx->b)) {
               const char *ignore;
   
  +            e = APR_BRIGADE_FIRST(ctx->b);
               if ((rv = apr_bucket_read(e, &ignore, &len, mode)) != APR_SUCCESS) {
                   /* probably APR_IS_EAGAIN(rv); socket state isn't correct;
                    * remove log once we get this squared away */
  @@ -992,11 +989,7 @@
                   APR_BRIGADE_INSERT_TAIL(b, e);
                   break; /* once we've gotten some data, deliver it to caller */
               }
  -
  -            old = e;
  -            e = APR_BUCKET_NEXT(e);
  -            APR_BUCKET_REMOVE(old);
  -            apr_bucket_destroy(old);
  +            apr_bucket_delete(e);
           }
           if (f->c->remain == 0) {
               apr_bucket *eos = apr_bucket_eos_create();
  @@ -1067,8 +1060,7 @@
           }
           e = APR_BRIGADE_FIRST(b); 
           if (e->length == 0) {
  -            APR_BUCKET_REMOVE(e);
  -            apr_bucket_destroy(e);
  +            apr_bucket_delete(e);
               continue;
           }
           retval = apr_bucket_read(e, &temp, &length, APR_BLOCK_READ);
  @@ -1089,8 +1081,7 @@
           last_char = pos + length - 1;
           if (last_char < beyond_buff) {
               memcpy(pos, temp, length);
  -            APR_BUCKET_REMOVE(e);
  -            apr_bucket_destroy(e);
  +            apr_bucket_delete(e);
           }
           else {
               /* input line was larger than the caller's buffer */
  @@ -2799,8 +2790,7 @@
       } while (APR_BRIGADE_EMPTY(bb));
   
       if (APR_BUCKET_IS_EOS(b)) {         /* reached eos on previous invocation */
  -        APR_BUCKET_REMOVE(b);
  -        apr_bucket_destroy(b);
  +        apr_bucket_delete(b);
           return 0;
       }
   
  @@ -2824,8 +2814,7 @@
           r->remaining -= len_read;        /* XXX yank me? */
           old = b;
           b = APR_BUCKET_NEXT(b);
  -        APR_BUCKET_REMOVE(old);
  -        apr_bucket_destroy(old);
  +        apr_bucket_delete(old);
       }
   
       return total;
  
  
  
  1.90      +1 -2      httpd-2.0/modules/http/http_request.c
  
  Index: http_request.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/http/http_request.c,v
  retrieving revision 1.89
  retrieving revision 1.90
  diff -u -d -u -r1.89 -r1.90
  --- http_request.c	2001/02/18 02:58:51	1.89
  +++ http_request.c	2001/02/25 23:08:52	1.90
  @@ -806,8 +806,7 @@
       apr_bucket *e = APR_BRIGADE_LAST(bb);
   
       if (APR_BUCKET_IS_EOS(e)) {
  -        APR_BUCKET_REMOVE(e);
  -        apr_bucket_destroy(e);
  +        apr_bucket_delete(e);
       }
       ap_pass_brigade(f->next, bb);
       return APR_SUCCESS;