From: Cliff Woolley Date: Sun, 16 Nov 2003 02:09:14 +0000 (+0000) Subject: get rid of _FOREACH X-Git-Tag: pre_ajp_proxy~1043 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=aaf0424e2b4336bbb15cee3712091b90c4fbf1ae;p=thirdparty%2Fapache%2Fhttpd.git get rid of _FOREACH git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@101788 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/dav/main/mod_dav.c b/modules/dav/main/mod_dav.c index 62901ffc52b..2ad0e657863 100644 --- a/modules/dav/main/mod_dav.c +++ b/modules/dav/main/mod_dav.c @@ -997,7 +997,10 @@ static int dav_method_put(request_rec *r) break; } - APR_BRIGADE_FOREACH(b, bb) { + for (b = APR_BRIGADE_FIRST(bb); + b != APR_BRIGADE_SENTINEL(bb); + b = APR_BUCKET_NEXT(b)) + { const char *data; apr_size_t len; diff --git a/modules/experimental/mod_cache.c b/modules/experimental/mod_cache.c index 95929628a90..90aeb74e1b1 100644 --- a/modules/experimental/mod_cache.c +++ b/modules/experimental/mod_cache.c @@ -643,7 +643,10 @@ static int cache_in_filter(ap_filter_t *f, apr_bucket_brigade *in) int all_buckets_here=0; int unresolved_length = 0; size=0; - APR_BRIGADE_FOREACH(e, in) { + for (e = APR_BRIGADE_FIRST(in); + e != APR_BRIGADE_SENTINEL(in); + e = APR_BUCKET_NEXT(e)) + { if (APR_BUCKET_IS_EOS(e)) { all_buckets_here=1; break; diff --git a/modules/experimental/mod_case_filter.c b/modules/experimental/mod_case_filter.c index 88ec17d86ae..2cd6fa62f30 100644 --- a/modules/experimental/mod_case_filter.c +++ b/modules/experimental/mod_case_filter.c @@ -99,8 +99,10 @@ static apr_status_t CaseFilterOutFilter(ap_filter_t *f, apr_bucket_brigade *pbbOut; pbbOut=apr_brigade_create(r->pool, c->bucket_alloc); - APR_BRIGADE_FOREACH(pbktIn,pbbIn) - { + for (pbktIn = APR_BRIGADE_FIRST(pbbIn); + pbktIn != APR_BRIGADE_SENTINEL(pbbIn); + pbktIn = APR_BUCKET_NEXT(pbktIn)) + { const char *data; apr_size_t len; char *buf; diff --git a/modules/experimental/mod_disk_cache.c b/modules/experimental/mod_disk_cache.c index ab2a4ab5ae4..c8ab2ad10bd 100644 --- a/modules/experimental/mod_disk_cache.c +++ b/modules/experimental/mod_disk_cache.c @@ -679,7 +679,10 @@ static apr_status_t write_body(cache_handle_t *h, request_rec *r, apr_bucket_bri return rv; } } - APR_BRIGADE_FOREACH(e, b) { + for (e = APR_BRIGADE_FIRST(b); + e != APR_BRIGADE_SENTINEL(b); + e = APR_BUCKET_NEXT(e)) + { const char *str; apr_size_t length; apr_bucket_read(e, &str, &length, APR_BLOCK_READ); diff --git a/modules/experimental/mod_mem_cache.c b/modules/experimental/mod_mem_cache.c index 138693673ab..29be3290336 100644 --- a/modules/experimental/mod_mem_cache.c +++ b/modules/experimental/mod_mem_cache.c @@ -957,7 +957,10 @@ static apr_status_t write_body(cache_handle_t *h, request_rec *r, apr_bucket_bri * - the brigade is complete && * - the file_bucket is the last data bucket in the brigade */ - APR_BRIGADE_FOREACH(e, b) { + for (e = APR_BRIGADE_FIRST(b); + e != APR_BRIGADE_SENTINEL(b); + e = APR_BUCKET_NEXT(e)) + { if (APR_BUCKET_IS_EOS(e)) { eos = 1; } @@ -1010,7 +1013,10 @@ static apr_status_t write_body(cache_handle_t *h, request_rec *r, apr_bucket_bri cur = (char*) mobj->m + obj->count; /* Iterate accross the brigade and populate the cache storage */ - APR_BRIGADE_FOREACH(e, b) { + for (e = APR_BRIGADE_FIRST(b); + e != APR_BRIGADE_SENTINEL(b); + e = APR_BUCKET_NEXT(e)) + { const char *s; apr_size_t len; diff --git a/modules/filters/mod_deflate.c b/modules/filters/mod_deflate.c index 74d3c039743..7710925b90c 100644 --- a/modules/filters/mod_deflate.c +++ b/modules/filters/mod_deflate.c @@ -452,7 +452,10 @@ static apr_status_t deflate_out_filter(ap_filter_t *f, ctx->stream.avail_out = c->bufferSize; } - APR_BRIGADE_FOREACH(e, bb) { + for (e = APR_BRIGADE_FIRST(bb); + e != APR_BRIGADE_SENTINEL(bb); + e = APR_BUCKET_NEXT(e)) + { const char *data; apr_bucket *b; apr_size_t len; @@ -724,7 +727,10 @@ static apr_status_t deflate_in_filter(ap_filter_t *f, return rv; } - APR_BRIGADE_FOREACH(bkt, ctx->bb) { + for (bkt = APR_BRIGADE_FIRST(ctx->bb); + bkt != APR_BRIGADE_SENTINEL(ctx->bb); + bkt = APR_BUCKET_NEXT(bkt)) + { const char *data; apr_size_t len; diff --git a/modules/filters/mod_ext_filter.c b/modules/filters/mod_ext_filter.c index d962fbd5711..64b909cc00d 100644 --- a/modules/filters/mod_ext_filter.c +++ b/modules/filters/mod_ext_filter.c @@ -789,8 +789,10 @@ static int ef_unified_filter(ap_filter_t *f, apr_bucket_brigade *bb) dc = ctx->dc; bb_tmp = apr_brigade_create(r->pool, c->bucket_alloc); - APR_BRIGADE_FOREACH(b, bb) { - + for (b = APR_BRIGADE_FIRST(bb); + b != APR_BRIGADE_SENTINEL(bb); + b = APR_BUCKET_NEXT(b)) + { if (APR_BUCKET_IS_EOS(b)) { eos = b; break; diff --git a/modules/generators/mod_cgi.c b/modules/generators/mod_cgi.c index ed4e5bc05b8..db7801305e1 100644 --- a/modules/generators/mod_cgi.c +++ b/modules/generators/mod_cgi.c @@ -314,7 +314,10 @@ static int log_script(request_rec *r, cgi_server_conf * conf, int ret, apr_file_printf(f, "%s\n", sbuf); first = 1; - APR_BRIGADE_FOREACH(e, bb) { + for (e = APR_BRIGADE_FIRST(bb); + e != APR_BRIGADE_SENTINEL(bb); + e = APR_BUCKET_NEXT(e)) + { if (APR_BUCKET_IS_EOS(e)) { break; } @@ -564,7 +567,11 @@ static void discard_script_output(apr_bucket_brigade *bb) const char *buf; apr_size_t len; apr_status_t rv; - APR_BRIGADE_FOREACH(e, bb) { + + for (e = APR_BRIGADE_FIRST(bb); + e != APR_BRIGADE_SENTINEL(bb); + e = APR_BUCKET_NEXT(e)) + { if (APR_BUCKET_IS_EOS(e)) { break; } @@ -690,7 +697,10 @@ static int cgi_handler(request_rec *r) return rv; } - APR_BRIGADE_FOREACH(bucket, bb) { + for (bucket = APR_BRIGADE_FIRST(bb); + bucket != APR_BRIGADE_SENTINEL(bb); + bucket = APR_BUCKET_NEXT(bucket)) + { const char *data; apr_size_t len; diff --git a/modules/generators/mod_cgid.c b/modules/generators/mod_cgid.c index 233f3bfde2a..c4cd28d576c 100644 --- a/modules/generators/mod_cgid.c +++ b/modules/generators/mod_cgid.c @@ -1058,7 +1058,11 @@ static int log_script(request_rec *r, cgid_server_conf * conf, int ret, apr_file_printf(f, "%s\n", sbuf); first = 1; - APR_BRIGADE_FOREACH(e, bb) { + + for (e = APR_BRIGADE_FIRST(bb); + e != APR_BRIGADE_SENTINEL(bb); + e = APR_BUCKET_NEXT(e)) + { if (APR_BUCKET_IS_EOS(e)) { break; } @@ -1159,7 +1163,11 @@ static void discard_script_output(apr_bucket_brigade *bb) const char *buf; apr_size_t len; apr_status_t rv; - APR_BRIGADE_FOREACH(e, bb) { + + for (e = APR_BRIGADE_FIRST(bb); + e != APR_BRIGADE_SENTINEL(bb); + e = APR_BUCKET_NEXT(e)) + { if (APR_BUCKET_IS_EOS(e)) { break; } @@ -1398,7 +1406,10 @@ static int cgid_handler(request_rec *r) return rv; } - APR_BRIGADE_FOREACH(bucket, bb) { + for (bucket = APR_BRIGADE_FIRST(bb); + bucket != APR_BRIGADE_SENTINEL(bb); + bucket = APR_BUCKET_NEXT(bucket)) + { const char *data; apr_size_t len; diff --git a/modules/http/http_core.c b/modules/http/http_core.c index f2c51c9cda3..50611639197 100644 --- a/modules/http/http_core.c +++ b/modules/http/http_core.c @@ -158,7 +158,11 @@ static apr_status_t chunk_filter(ap_filter_t *f, apr_bucket_brigade *b) */ char chunk_hdr[20]; /* enough space for the snprintf below */ - APR_BRIGADE_FOREACH(e, b) { + + for (e = APR_BRIGADE_FIRST(b); + e != APR_BRIGADE_SENTINEL(b); + e = APR_BUCKET_NEXT(e)) + { if (APR_BUCKET_IS_EOS(e)) { /* there shouldn't be anything after the eos */ eos = e; diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c index e6c33196ccd..ce7c60a1955 100644 --- a/modules/http/http_protocol.c +++ b/modules/http/http_protocol.c @@ -1583,7 +1583,10 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_http_header_filter(ap_filter_t *f, } } - APR_BRIGADE_FOREACH(e, b) { + for (e = APR_BRIGADE_FIRST(b); + e != APR_BRIGADE_SENTINEL(b); + e = APR_BUCKET_NEXT(e)) + { if (e->type == &ap_bucket_type_error) { ap_bucket_error *eb = e->data; @@ -2025,7 +2028,10 @@ AP_DECLARE(int) ap_discard_request_body(request_rec *r) } } - APR_BRIGADE_FOREACH(bucket, bb) { + for (bucket = APR_BRIGADE_FIRST(bb); + bucket != APR_BRIGADE_SENTINEL(bb); + bucket = APR_BUCKET_NEXT(bucket)) + { const char *data; apr_size_t len; diff --git a/modules/test/mod_bucketeer.c b/modules/test/mod_bucketeer.c index 198a2cf683a..f63b04cdb04 100644 --- a/modules/test/mod_bucketeer.c +++ b/modules/test/mod_bucketeer.c @@ -119,7 +119,10 @@ static apr_status_t bucketeer_out_filter(ap_filter_t *f, apr_table_unset(f->r->headers_out, "Content-Length"); } - APR_BRIGADE_FOREACH(e, bb) { + for (e = APR_BRIGADE_FIRST(bb); + e != APR_BRIGADE_SENTINEL(bb); + e = APR_BUCKET_NEXT(e)) + { const char *data; apr_size_t len, i, lastpos; diff --git a/server/core.c b/server/core.c index 14e3f7e0750..1a703fba9cb 100644 --- a/server/core.c +++ b/server/core.c @@ -3794,7 +3794,11 @@ static int core_input_filter(ap_filter_t *f, apr_bucket_brigade *b, } else if (mode == AP_MODE_SPECULATIVE) { apr_bucket *copy_bucket; - APR_BRIGADE_FOREACH(e, ctx->b) { + + for (e = APR_BRIGADE_FIRST(ctx->b); + e != APR_BRIGADE_SENTINEL(ctx->b); + e = APR_BUCKET_NEXT(e)) + { rv = apr_bucket_copy(e, ©_bucket); if (rv != APR_SUCCESS) { return rv; @@ -3869,7 +3873,10 @@ static apr_status_t core_output_filter(ap_filter_t *f, apr_bucket_brigade *b) more = NULL; /* Iterate over the brigade: collect iovecs and/or a file */ - APR_BRIGADE_FOREACH(e, b) { + for (e = APR_BRIGADE_FIRST(b); + e != APR_BRIGADE_SENTINEL(b); + e = APR_BUCKET_NEXT(e)) + { /* keep track of the last bucket processed */ last_e = e; if (APR_BUCKET_IS_EOS(e)) { diff --git a/server/protocol.c b/server/protocol.c index 8ca2cad39e2..e5755969842 100644 --- a/server/protocol.c +++ b/server/protocol.c @@ -266,7 +266,10 @@ AP_DECLARE(apr_status_t) ap_rgetline_core(char **s, apr_size_t n, return APR_EGENERAL; } - APR_BRIGADE_FOREACH(e, bb) { + for (e = APR_BRIGADE_FIRST(bb); + e != APR_BRIGADE_SENTINEL(bb); + e = APR_BUCKET_NEXT(e)) + { const char *str; apr_size_t len; diff --git a/server/util_filter.c b/server/util_filter.c index 308e24ae21d..2aa962f70be 100644 --- a/server/util_filter.c +++ b/server/util_filter.c @@ -566,7 +566,10 @@ AP_DECLARE(apr_status_t) ap_save_brigade(ap_filter_t *f, *saveto = apr_brigade_create(p, f->c->bucket_alloc); } - APR_RING_FOREACH(e, &(*b)->list, apr_bucket, link) { + for (e = APR_BRIGADE_FIRST(*b); + e != APR_BRIGADE_SENTINEL(*b); + e = APR_BUCKET_NEXT(e)) + { rv = apr_bucket_setaside(e, p); if (rv != APR_SUCCESS /* ### this ENOTIMPL will go away once we implement setaside diff --git a/server/util_xml.c b/server/util_xml.c index 03f6df042df..0188a0980a8 100644 --- a/server/util_xml.c +++ b/server/util_xml.c @@ -94,7 +94,10 @@ AP_DECLARE(int) ap_xml_parse_input(request_rec * r, apr_xml_doc **pdoc) goto read_error; } - APR_BRIGADE_FOREACH(bucket, brigade) { + for (bucket = APR_BRIGADE_FIRST(brigade); + bucket != APR_BRIGADE_SENTINEL(brigade); + bucket = APR_BUCKET_NEXT(bucket)) + { const char *data; apr_size_t len;