summaryrefslogtreecommitdiff
path: root/buckets
diff options
context:
space:
mode:
authorRyan Bloom <rbb@apache.org>2000-07-12 22:12:49 +0000
committerRyan Bloom <rbb@apache.org>2000-07-12 22:12:49 +0000
commit4fae4fb444643cae780e4524645c8663c5f62b23 (patch)
treeba7a09ff2bd52d10b8a1a8907159ebd449b3310c /buckets
parent231b337ff5c57ed054381b147f8b5f01d805c690 (diff)
downloadapr-4fae4fb444643cae780e4524645c8663c5f62b23.tar.gz
Add ap_consume_buckets. This just destroys a specified number of buckets
off the front of the brigade. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@60340 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'buckets')
-rw-r--r--buckets/ap_buf.c16
-rw-r--r--buckets/apr_buf.h6
2 files changed, 20 insertions, 2 deletions
diff --git a/buckets/ap_buf.c b/buckets/ap_buf.c
index 1e2894103..308e9fb1b 100644
--- a/buckets/ap_buf.c
+++ b/buckets/ap_buf.c
@@ -187,6 +187,22 @@ APR_EXPORT(void) ap_bucket_brigade_catenate(ap_bucket_brigade *a,
}
}
+APR_EXPORT(void) ap_consume_buckets(ap_bucket_brigade *b, int nvec)
+{
+ int i;
+
+ for (i=0; i < nvec; i++) {
+ if (b->head == b->tail) {
+ ap_bucket_destroy(b->head->bucket);
+ b->head = b->tail = NULL;
+ break;
+ }
+ b->head = b->head->next;
+ ap_bucket_destroy(b->head->prev->bucket);
+ b->head->prev = NULL;
+ }
+}
+
APR_EXPORT(ap_status_t) ap_bucket_brigade_to_iol(ap_ssize_t *total_bytes,
ap_bucket_brigade *b,
ap_iol *iol)
diff --git a/buckets/apr_buf.h b/buckets/apr_buf.h
index adee93c4c..230146572 100644
--- a/buckets/apr_buf.h
+++ b/buckets/apr_buf.h
@@ -130,6 +130,9 @@ APR_EXPORT(int) ap_bucket_brigade_to_iovec(ap_bucket_brigade *,
APR_EXPORT(void) ap_bucket_brigade_catenate(ap_bucket_brigade *a,
ap_bucket_brigade *b);
+/* Destroy the first nvec buckets. */
+APR_EXPORT(void) ap_consume_buckets(ap_bucket_brigade *b, int nvec);
+
/* save the buf out to the specified iol. This can be used to flush the
data to the disk, or to send it out to the network. */
APR_EXPORT(ap_status_t) ap_bucket_brigade_to_iol(ap_ssize_t *total_bytes,
@@ -140,8 +143,7 @@ APR_EXPORT(int) ap_brigade_vputstrs(ap_bucket_brigade *b, va_list va);
APR_EXPORT(int) ap_brigade_printf(ap_bucket_brigade *b, const char *fmt, ...);
-APR_EXPORT(int) ap_brigade_vprintf(ap_bucket_brigade *b, const char *fmt, va_lis
-t va);
+APR_EXPORT(int) ap_brigade_vprintf(ap_bucket_brigade *b, const char *fmt, va_list va);
/* ****** Bucket List Functions ***** */