jwoolley 01/04/02 12:02:16
Modified: buckets apr_brigade.c
include apr_buckets.h
Log:
Make apr_brigade_cleanup() a public function. This is not intended to
replace apr_brigade_destroy(), which is still usually preferred.
It's useful, though, when the caller has a brigade it uses for
temporary storage of some data that it frequently flushes out.
This way, the brigade structure can be reused without prematurely
deregistering it or destroying it and creating a new one. (eg, Apache's
mod_include needs this.)
Revision Changes Path
1.13 +2 -1 apr-util/buckets/apr_brigade.c
Index: apr_brigade.c
===================================================================
RCS file: /home/cvs/apr-util/buckets/apr_brigade.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -u -r1.12 -r1.13
--- apr_brigade.c 2001/02/28 17:35:42 1.12
+++ apr_brigade.c 2001/04/02 19:02:13 1.13
@@ -67,7 +67,7 @@
#include <sys/uio.h>
#endif
-static apr_status_t apr_brigade_cleanup(void *data)
+APU_DECLARE(apr_status_t) apr_brigade_cleanup(void *data)
{
apr_bucket_brigade *b = data;
apr_bucket *e;
@@ -85,6 +85,7 @@
*/
return APR_SUCCESS;
}
+
APU_DECLARE(apr_status_t) apr_brigade_destroy(apr_bucket_brigade *b)
{
apr_pool_cleanup_kill(b->p, b, apr_brigade_cleanup);
1.88 +14 -0 apr-util/include/apr_buckets.h
Index: apr_buckets.h
===================================================================
RCS file: /home/cvs/apr-util/include/apr_buckets.h,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -d -u -r1.87 -r1.88
--- apr_buckets.h 2001/03/01 04:46:13 1.87
+++ apr_buckets.h 2001/04/02 19:02:15 1.88
@@ -589,6 +589,20 @@
APU_DECLARE(apr_status_t) apr_brigade_destroy(apr_bucket_brigade *b);
/**
+ * empty out an entire bucket brigade. This includes destroying all of the
+ * buckets within the bucket brigade's bucket list. This is similar to
+ * apr_brigade_destroy(), except that it does not deregister the brigade's
+ * pool cleanup function.
+ * @tip Generally, you should use apr_brigade_destroy(). This function
+ * can be useful in situations where you have a single brigade that
+ * you wish to reuse many times by destroying all of the buckets in
+ * the brigade and putting new buckets into it later.
+ * @param b The bucket brigade to clean up
+ * @deffunc apr_status_t apr_brigade_cleanup(apr_bucket_brigade *b)
+ */
+APU_DECLARE(apr_status_t) apr_brigade_cleanup(void *data);
+
+/**
* Split a bucket brigade into two, such that the given bucket is the
* first in the new bucket brigade. This function is useful when a
* filter wants to pass only the initial part of a brigade to the next