From: Jeff Trawick Date: Sun, 17 Feb 2002 19:21:31 +0000 (+0000) Subject: stop using APR_BRIGADE_NORMALIZE() X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=353e96e9702c73cd785d2015b0d96031914d8203;p=apache stop using APR_BRIGADE_NORMALIZE() (okay, making a copy of it is cheating perhaps, but the name of the game is to get APR_BRIGADE_NORMALIZE() out of the API) git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93458 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/STATUS b/STATUS index c65640d11e..268deb878f 100644 --- a/STATUS +++ b/STATUS @@ -1,5 +1,5 @@ APACHE 2.0 STATUS: -*-text-*- -Last modified at [$Date: 2002/02/17 07:09:00 $] +Last modified at [$Date: 2002/02/17 19:21:31 $] Release: @@ -74,10 +74,6 @@ FINAL RELEASE SHOWSTOPPERS: * API changes planned for 2.0 that should happen before the GA release: * Free lists for bucket allocation - * Removal of APR_BRIGADE_NORMALIZE from the public bucket API - Justin says: "APR_BRIGADE_NORMALIZE is not a showstopper since no - one uses it except for core_input_filter. If its - use was prevalent, that'd be a different story." CURRENT VOTES: diff --git a/server/core.c b/server/core.c index 95e4f10191..0b7a0f975d 100644 --- a/server/core.c +++ b/server/core.c @@ -3026,6 +3026,23 @@ static int net_time_filter(ap_filter_t *f, apr_bucket_brigade *b, return ap_get_brigade(f->next, b, mode, block, readbytes); } +/** + * Remove all zero length buckets from the brigade. + */ +#define BRIGADE_NORMALIZE(b) \ +do { \ + apr_bucket *e = APR_BRIGADE_FIRST(b); \ + do { \ + if (e->length == 0) { \ + apr_bucket *d; \ + d = APR_BUCKET_NEXT(e); \ + apr_bucket_delete(e); \ + e = d; \ + } \ + e = APR_BUCKET_NEXT(e); \ + } while (!APR_BRIGADE_EMPTY(b) && (e != APR_BRIGADE_SENTINEL(b))); \ +} while (0) + static int core_input_filter(ap_filter_t *f, apr_bucket_brigade *b, ap_input_mode_t mode, apr_read_type_e block, apr_off_t readbytes) @@ -3066,9 +3083,9 @@ static int core_input_filter(ap_filter_t *f, apr_bucket_brigade *b, } /* ### This is bad. */ - APR_BRIGADE_NORMALIZE(ctx->b); + BRIGADE_NORMALIZE(ctx->b); - /* check for empty brigade again *AFTER* APR_BRIGADE_NORMALIZE() + /* check for empty brigade again *AFTER* BRIGADE_NORMALIZE() * If we have lost our socket bucket (see above), we are EOF. * * Ideally, this should be returning SUCCESS with EOS bucket, but