From fb0ad3fd895bae7dc57ea3c1cae81dc4108e0a81 Mon Sep 17 00:00:00 2001 From: Christophe Jaillet Date: Fri, 1 Aug 2014 04:23:50 +0000 Subject: [PATCH] Turn some APR_BUCKET_REMOVE(e)+apr_bucket_destroy(e) into the equivalent apr_bucket_delete(e) to reduce code verbosity git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1615026 13f79535-47bb-0310-9956-ffa450edef68 --- 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 +-- 5 files changed, 14 insertions(+), 28 deletions(-) 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 f638843329..cc11140ada 100644 --- a/modules/http/byterange_filter.c +++ b/modules/http/byterange_filter.c @@ -350,8 +350,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; @@ -370,8 +369,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 3005add5b0..98a74f10c0 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 8a967b5138..92eb216f23 100644 --- a/server/core_filters.c +++ b/server/core_filters.c @@ -750,8 +750,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); } } @@ -824,19 +823,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; @@ -915,12 +911,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 fb8eac5387..87504fac32 100644 --- a/server/util_script.c +++ b/server/util_script.c @@ -705,8 +705,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