Attached is a patch to change all of these:

    APR_BUCKET_REMOVE(e);
    apr_bucket_destroy(e);

To these:

    apr_bucket_delete(e);

(Oh, plus one tiny little loop simplification.)

The patch to cleanup APR_BUCKET_INSERT_* and APR_BRIGADE_INSERT_* is also
done, but it's easier on me if I submit them one at a time... so once this
one is committed, I'll submit that one.  And then after that there will
probably be other, more important ones (I'm still trying to track down
that darned bucket assert failure; in the process, I cleaned up a few of
the functions in http_protocol.c to make it easier for me to figure out
what they're doing). ... I just had all these little patches piling up on
me toward critical mass... time to flush the sandbox.

--Cliff


PS: Hey Jeff/Greg... I spent all morning resurrecting my dead Linux box so
as to ditch Windows/Outlook, rather than patching like crazy like I'd
planned.  Oh well, such is the cost of maintaining one's geek-integrity.
=-]
Index: modules/experimental/mod_charset_lite.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/experimental/mod_charset_lite.c,v
retrieving revision 1.42
diff -u -d -u -r1.42 mod_charset_lite.c
--- modules/experimental/mod_charset_lite.c     2001/02/16 04:26:37     1.42
+++ modules/experimental/mod_charset_lite.c     2001/02/23 22:46:03
@@ -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)) {
Index: modules/filters/mod_include.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/filters/mod_include.c,v
retrieving revision 1.99
diff -u -d -u -r1.99 mod_include.c
--- modules/filters/mod_include.c       2001/02/16 13:38:21     1.99
+++ modules/filters/mod_include.c       2001/02/23 22:46:03
@@ -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... */
Index: modules/http/http_core.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/http/http_core.c,v
retrieving revision 1.262
diff -u -d -u -r1.262 http_core.c
--- modules/http/http_core.c    2001/02/18 04:26:13     1.262
+++ modules/http/http_core.c    2001/02/23 22:46:03
@@ -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;
Index: modules/http/http_protocol.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/http/http_protocol.c,v
retrieving revision 1.299
diff -u -d -u -r1.299 http_protocol.c
--- modules/http/http_protocol.c        2001/02/21 21:14:33     1.299
+++ modules/http/http_protocol.c        2001/02/23 22:46:05
@@ -886,8 +886,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;
         }
     }
@@ -950,8 +949,7 @@
                         c += 2;
                     else return APR_SUCCESS;
                 }
-                APR_BUCKET_REMOVE(e);
-                apr_bucket_destroy(e);
+                apr_bucket_delete(e);
             }
         }
     }
@@ -963,11 +961,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 */
@@ -988,11 +985,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();
@@ -1063,8 +1056,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);
@@ -1085,8 +1077,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 */
@@ -2795,8 +2786,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;
     }
 
@@ -2820,8 +2810,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;
Index: modules/http/http_request.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/http/http_request.c,v
retrieving revision 1.89
diff -u -d -u -r1.89 http_request.c
--- modules/http/http_request.c 2001/02/18 02:58:51     1.89
+++ modules/http/http_request.c 2001/02/23 22:46:05
@@ -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;

Reply via email to