jwoolley 2003/11/15 17:36:28
Modified: buckets apr_brigade.c
include apr_buckets.h
Log:
rip
Revision Changes Path
1.59 +19 -12 apr-util/buckets/apr_brigade.c
Index: apr_brigade.c
===================================================================
RCS file: /home/cvs/apr-util/buckets/apr_brigade.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -u -r1.58 -r1.59
--- apr_brigade.c 28 Aug 2003 02:09:52 -0000 1.58
+++ apr_brigade.c 16 Nov 2003 01:36:28 -0000 1.59
@@ -77,17 +77,11 @@
apr_bucket_brigade *b = data;
apr_bucket *e;
- /*
- * Bah! We can't use APR_RING_FOREACH here because this bucket has
- * gone away when we dig inside it to get the next one.
- */
while (!APR_BRIGADE_EMPTY(b)) {
e = APR_BRIGADE_FIRST(b);
apr_bucket_delete(e);
}
- /*
- * We don't need to free(bb) because it's allocated from a pool.
- */
+ /* We don't need to free(bb) because it's allocated from a pool. */
return APR_SUCCESS;
}
@@ -154,9 +148,12 @@
APR_BRIGADE_CHECK_CONSISTENCY(b);
- APR_BRIGADE_FOREACH(e, b) {
+ for (e = APR_BRIGADE_FIRST(b);
+ e != APR_BRIGADE_SENTINEL(b);
+ e = APR_BUCKET_NEXT(e))
+ {
if ((e->length == (apr_size_t)(-1)) && (point > (apr_size_t)(-1))) {
- /* XXX: point is too far out to simply split this bucket,
+ /* point is too far out to simply split this bucket,
* we must fix this bucket's size and keep going... */
rv = apr_bucket_read(e, &s, &len, APR_BLOCK_READ);
if (rv != APR_SUCCESS) {
@@ -207,7 +204,10 @@
apr_off_t total = 0;
apr_bucket *bkt;
- APR_BRIGADE_FOREACH(bkt, bb) {
+ for (bkt = APR_BRIGADE_FIRST(bb);
+ bkt != APR_BRIGADE_SENTINEL(bb);
+ bkt = APR_BUCKET_NEXT(bkt))
+ {
if (bkt->length == (apr_size_t)(-1)) {
const char *ignore;
apr_size_t len;
@@ -237,7 +237,10 @@
apr_size_t actual = 0;
apr_bucket *b;
- APR_BRIGADE_FOREACH(b, bb) {
+ for (b = APR_BRIGADE_FIRST(bb);
+ b != APR_BRIGADE_SENTINEL(bb);
+ b = APR_BUCKET_NEXT(b))
+ {
const char *str;
apr_size_t str_len;
apr_status_t status;
@@ -361,7 +364,11 @@
apr_status_t rv;
orig = vec;
- APR_BRIGADE_FOREACH(e, b) {
+
+ for (e = APR_BRIGADE_FIRST(b);
+ e != APR_BRIGADE_SENTINEL(b);
+ e = APR_BUCKET_NEXT(e))
+ {
if (left-- == 0)
break;
1.155 +0 -44 apr-util/include/apr_buckets.h
Index: apr_buckets.h
===================================================================
RCS file: /home/cvs/apr-util/include/apr_buckets.h,v
retrieving revision 1.154
retrieving revision 1.155
diff -u -d -u -r1.154 -r1.155
--- apr_buckets.h 28 Aug 2003 05:48:29 -0000 1.154
+++ apr_buckets.h 16 Nov 2003 01:36:28 -0000 1.155
@@ -389,50 +389,6 @@
#define APR_BRIGADE_LAST(b) APR_RING_LAST(&(b)->list)
/**
- * Iterate through a bucket brigade
- * @param e The current bucket
- * @param b The brigade to iterate over
- * @remark This is the same as either:
- * <pre>
- * e = APR_BRIGADE_FIRST(b);
- * while (e != APR_BRIGADE_SENTINEL(b)) {
- * ...
- * e = APR_BUCKET_NEXT(e);
- * }
- * OR
- * for (e = APR_BRIGADE_FIRST(b);
- * e != APR_BRIGADE_SENTINEL(b);
- * e = APR_BUCKET_NEXT(e)) {
- * ...
- * }
- * </pre>
- * @warning Be aware that you cannot change the value of e within
- * the foreach loop, nor can you destroy the bucket it points to.
- * Modifying the prev and next pointers of the bucket is dangerous
- * but can be done if you're careful. If you change e's value or
- * destroy the bucket it points to, then APR_BRIGADE_FOREACH
- * will have no way to find out what bucket to use for its next
- * iteration. The reason for this can be seen by looking closely
- * at the equivalent loops given in the tip above. So, for example,
- * if you are writing a loop that empties out a brigade one bucket
- * at a time, APR_BRIGADE_FOREACH just won't work for you. Do it
- * by hand, like so:
- * <pre>
- * while (!APR_BRIGADE_EMPTY(b)) {
- * e = APR_BRIGADE_FIRST(b);
- * ...
- * apr_bucket_delete(e);
- * }
- * </pre>
- * @deprecated This macro causes more headaches than it's worth. Use
- * one of the alternatives documented here instead; the clarity gained
- * in what's really going on is well worth the extra line or two of code.
- * This macro will be removed at some point in the future.
- */
-#define APR_BRIGADE_FOREACH(e, b) \
- APR_RING_FOREACH((e), &(b)->list, apr_bucket, link)
-
-/**
* Insert a list of buckets at the front of a brigade
* @param b The brigade to add to
* @param e The first bucket in a list of buckets to insert