From 8147a938460076828a4ecdbbd83b3527817d7f70 Mon Sep 17 00:00:00 2001 From: Jim Jagielski Date: Sun, 31 Aug 2014 16:06:36 +0000 Subject: [PATCH] Merge r1615026 from trunk: Turn some APR_BUCKET_REMOVE(e)+apr_bucket_destroy(e) into the equivalent apr_bucket_delete(e) to reduce code verbosity Submitted by: jailletc36 Reviewed/backported by: jim git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1621600 13f79535-47bb-0310-9956-ffa450edef68 --- STATUS | 6 ------ modules/filters/mod_xml2enc.c | 9 +++------ modules/http/byterange_filter.c | 6 ++---- modules/proxy/mod_proxy_ftp.c | 6 ++---- server/core_filters.c | 18 ++++++------------ server/util_script.c | 3 +-- 6 files changed, 14 insertions(+), 34 deletions(-) diff --git a/STATUS b/STATUS index e09c244206..2f06038ba6 100644 --- a/STATUS +++ b/STATUS @@ -101,12 +101,6 @@ RELEASE SHOWSTOPPERS: PATCHES ACCEPTED TO BACKPORT FROM TRUNK: [ start all new proposals below, under PATCHES PROPOSED. ] - * Turn some APR_BUCKET_REMOVE(e)+apr_bucket_destroy(e) into the equivalent - apr_bucket_delete(e) to reduce code verbosity - trunk patch: http://svn.apache.org/r1615026 - 2.4.x patch: trunk patch works - +1: jailletc36, ylavic, covener - * mod_proxy_http: Proxy responses with error status and "ProxyErrorOverride On" hang until proxy timeout. PR53420 Regression from 2.2. It was introduced by r912063 in order to fix PR41646. diff --git a/modules/filters/mod_xml2enc.c b/modules/filters/mod_xml2enc.c index a4202a288e..d28c97d1be 100644 --- a/modules/filters/mod_xml2enc.c +++ b/modules/filters/mod_xml2enc.c @@ -142,8 +142,7 @@ static void fix_skipto(request_rec* r, xml2ctx* ctx) &bstart); ap_assert(rv == APR_SUCCESS); while (b = APR_BRIGADE_FIRST(ctx->bbsave), b != bstart) { - APR_BUCKET_REMOVE(b); - apr_bucket_destroy(b); + apr_bucket_delete(b); } ctx->bytes -= (p-ctx->buf); ctx->buf = p ; @@ -228,8 +227,7 @@ static void sniff_encoding(request_rec* r, xml2ctx* ctx) /* cut out the we're invalidating */ while (cutb != cute) { b = APR_BUCKET_NEXT(cutb); - APR_BUCKET_REMOVE(cutb); - apr_bucket_destroy(cutb); + apr_bucket_delete(cutb); cutb = b; } /* and leave a string */ @@ -435,8 +433,7 @@ static apr_status_t xml2enc_ffunc(ap_filter_t* f, apr_bucket_brigade* bb) /* remove the data we've just read */ rv = apr_brigade_partition(bb, bytes, &bstart); while (b = APR_BRIGADE_FIRST(bb), b != bstart) { - APR_BUCKET_REMOVE(b); - apr_bucket_destroy(b); + apr_bucket_delete(b); } ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, f->r, APLOGNO(01438) "xml2enc: consuming %" APR_SIZE_T_FMT diff --git a/modules/http/byterange_filter.c b/modules/http/byterange_filter.c index 09f1956581..de585c5750 100644 --- a/modules/http/byterange_filter.c +++ b/modules/http/byterange_filter.c @@ -380,8 +380,7 @@ static apr_status_t copy_brigade_range(apr_bucket_brigade *bb, return rv; } out_first = APR_BUCKET_NEXT(copy); - APR_BUCKET_REMOVE(copy); - apr_bucket_destroy(copy); + apr_bucket_delete(copy); } else { out_first = copy; @@ -400,8 +399,7 @@ static apr_status_t copy_brigade_range(apr_bucket_brigade *bb, } copy = APR_BUCKET_NEXT(copy); if (copy != APR_BRIGADE_SENTINEL(bbout)) { - APR_BUCKET_REMOVE(copy); - apr_bucket_destroy(copy); + apr_bucket_delete(copy); } } break; diff --git a/modules/proxy/mod_proxy_ftp.c b/modules/proxy/mod_proxy_ftp.c index cf5d513026..8e0805f86b 100644 --- a/modules/proxy/mod_proxy_ftp.c +++ b/modules/proxy/mod_proxy_ftp.c @@ -275,8 +275,7 @@ static apr_status_t ftp_string_read(conn_rec *c, apr_bucket_brigade *bb, pos += len; } } - APR_BUCKET_REMOVE(e); - apr_bucket_destroy(e); + apr_bucket_delete(e); } *pos = '\0'; } @@ -634,8 +633,7 @@ static apr_status_t proxy_send_dir_filter(ap_filter_t *f, /* len+1 to leave space for the trailing nil char */ apr_cpystrn(ctx->buffer+strlen(ctx->buffer), response, len+1); - APR_BUCKET_REMOVE(e); - apr_bucket_destroy(e); + apr_bucket_delete(e); } /* EOS? jump to footer */ diff --git a/server/core_filters.c b/server/core_filters.c index 84e11497c1..8700b76d53 100644 --- a/server/core_filters.c +++ b/server/core_filters.c @@ -718,8 +718,7 @@ static void remove_empty_buckets(apr_bucket_brigade *bb) apr_bucket *bucket; while (((bucket = APR_BRIGADE_FIRST(bb)) != APR_BRIGADE_SENTINEL(bb)) && (APR_BUCKET_IS_METADATA(bucket) || (bucket->length == 0))) { - APR_BUCKET_REMOVE(bucket); - apr_bucket_destroy(bucket); + apr_bucket_delete(bucket); } } @@ -792,19 +791,16 @@ static apr_status_t writev_nonblocking(apr_socket_t *s, for (i = offset; i < nvec; ) { apr_bucket *bucket = APR_BRIGADE_FIRST(bb); if (APR_BUCKET_IS_METADATA(bucket)) { - APR_BUCKET_REMOVE(bucket); - apr_bucket_destroy(bucket); + apr_bucket_delete(bucket); } else if (n >= vec[i].iov_len) { - APR_BUCKET_REMOVE(bucket); - apr_bucket_destroy(bucket); + apr_bucket_delete(bucket); offset++; n -= vec[i++].iov_len; } else { apr_bucket_split(bucket, n); - APR_BUCKET_REMOVE(bucket); - apr_bucket_destroy(bucket); + apr_bucket_delete(bucket); vec[i].iov_len -= n; vec[i].iov_base = (char *) vec[i].iov_base + n; break; @@ -883,12 +879,10 @@ static apr_status_t sendfile_nonblocking(apr_socket_t *s, *cumulative_bytes_written += bytes_written; if ((bytes_written < file_length) && (bytes_written > 0)) { apr_bucket_split(bucket, bytes_written); - APR_BUCKET_REMOVE(bucket); - apr_bucket_destroy(bucket); + apr_bucket_delete(bucket); } else if (bytes_written == file_length) { - APR_BUCKET_REMOVE(bucket); - apr_bucket_destroy(bucket); + apr_bucket_delete(bucket); } return rv; } diff --git a/server/util_script.c b/server/util_script.c index 3bc1b00a63..10f61deef8 100644 --- a/server/util_script.c +++ b/server/util_script.c @@ -704,8 +704,7 @@ static int getsfunc_BRIGADE(char *buf, int len, void *arg) apr_bucket_split(e, src - bucket_data); } next = APR_BUCKET_NEXT(e); - APR_BUCKET_REMOVE(e); - apr_bucket_destroy(e); + apr_bucket_delete(e); e = next; } *dst = 0; -- 2.50.1