stoddard 01/08/03 07:21:52
Modified: . CHANGES
buckets apr_buckets_eos.c apr_buckets_file.c
apr_buckets_flush.c apr_buckets_heap.c
apr_buckets_mmap.c apr_buckets_pipe.c
apr_buckets_pool.c apr_buckets_simple.c
apr_buckets_socket.c
include apr_buckets.h
Log:
Extend apr_bucket_type_t to add a pointer to a function used
to free the bucket. This change enables custom buckets to
completely specify how they are to be allocated and freed.
Before this change, custom buckets were required to use the
same memory allocation scheme as the standard APR buckets.
[Saeid Sakhitab, Bill Stoddard]
Revision Changes Path
1.26 +7 -0 apr-util/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/apr-util/CHANGES,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- CHANGES 2001/08/01 21:20:06 1.25
+++ CHANGES 2001/08/03 14:21:52 1.26
@@ -1,5 +1,12 @@
Changes with APR-util b1
+ *) Extend apr_bucket_type_t to add a pointer to a function used
+ to free the bucket. This change enables custom buckets to
+ completely specify how they are to be allocated and freed.
+ Before this change, custom buckets were required to use the
+ same memory allocation scheme as the standard APR buckets.
+ [Saeid Sakhitab, Bill Stoddard]
+
*) Install Expat when installing APR-util. [Justin Erenkrantz]
*) Make APR-util configure script rely on APR. This removes the locally
1.27 +1 -0 apr-util/buckets/apr_buckets_eos.c
Index: apr_buckets_eos.c
===================================================================
RCS file: /home/cvs/apr-util/buckets/apr_buckets_eos.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- apr_buckets_eos.c 2001/06/19 18:48:24 1.26
+++ apr_buckets_eos.c 2001/08/03 14:21:52 1.27
@@ -90,6 +90,7 @@
APU_DECLARE_DATA const apr_bucket_type_t apr_bucket_type_eos = {
"EOS", 5,
apr_bucket_destroy_noop,
+ free,
eos_read,
apr_bucket_setaside_noop,
apr_bucket_split_notimpl,
1.52 +1 -0 apr-util/buckets/apr_buckets_file.c
Index: apr_buckets_file.c
===================================================================
RCS file: /home/cvs/apr-util/buckets/apr_buckets_file.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- apr_buckets_file.c 2001/07/24 20:36:03 1.51
+++ apr_buckets_file.c 2001/08/03 14:21:52 1.52
@@ -262,6 +262,7 @@
APU_DECLARE_DATA const apr_bucket_type_t apr_bucket_type_file = {
"FILE", 5,
file_destroy,
+ free,
file_read,
file_setaside,
apr_bucket_shared_split,
1.19 +1 -0 apr-util/buckets/apr_buckets_flush.c
Index: apr_buckets_flush.c
===================================================================
RCS file: /home/cvs/apr-util/buckets/apr_buckets_flush.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- apr_buckets_flush.c 2001/06/19 18:48:26 1.18
+++ apr_buckets_flush.c 2001/08/03 14:21:52 1.19
@@ -90,6 +90,7 @@
APU_DECLARE_DATA const apr_bucket_type_t apr_bucket_type_flush = {
"FLUSH", 5,
apr_bucket_destroy_noop,
+ free,
flush_read,
apr_bucket_setaside_noop,
apr_bucket_split_notimpl,
1.35 +1 -0 apr-util/buckets/apr_buckets_heap.c
Index: apr_buckets_heap.c
===================================================================
RCS file: /home/cvs/apr-util/buckets/apr_buckets_heap.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- apr_buckets_heap.c 2001/06/19 18:48:27 1.34
+++ apr_buckets_heap.c 2001/08/03 14:21:52 1.35
@@ -126,6 +126,7 @@
APU_DECLARE_DATA const apr_bucket_type_t apr_bucket_type_heap = {
"HEAP", 5,
heap_destroy,
+ free,
heap_read,
apr_bucket_setaside_noop,
apr_bucket_shared_split,
1.40 +1 -0 apr-util/buckets/apr_buckets_mmap.c
Index: apr_buckets_mmap.c
===================================================================
RCS file: /home/cvs/apr-util/buckets/apr_buckets_mmap.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- apr_buckets_mmap.c 2001/06/26 03:20:31 1.39
+++ apr_buckets_mmap.c 2001/08/03 14:21:52 1.40
@@ -144,6 +144,7 @@
APU_DECLARE_DATA const apr_bucket_type_t apr_bucket_type_mmap = {
"MMAP", 5,
mmap_destroy,
+ free,
mmap_read,
mmap_setaside,
apr_bucket_shared_split,
1.38 +1 -0 apr-util/buckets/apr_buckets_pipe.c
Index: apr_buckets_pipe.c
===================================================================
RCS file: /home/cvs/apr-util/buckets/apr_buckets_pipe.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- apr_buckets_pipe.c 2001/07/24 20:36:03 1.37
+++ apr_buckets_pipe.c 2001/08/03 14:21:52 1.38
@@ -153,6 +153,7 @@
APU_DECLARE_DATA const apr_bucket_type_t apr_bucket_type_pipe = {
"PIPE", 5,
apr_bucket_destroy_noop,
+ free,
pipe_read,
apr_bucket_setaside_notimpl,
apr_bucket_split_notimpl,
1.21 +1 -0 apr-util/buckets/apr_buckets_pool.c
Index: apr_buckets_pool.c
===================================================================
RCS file: /home/cvs/apr-util/buckets/apr_buckets_pool.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- apr_buckets_pool.c 2001/06/19 18:48:31 1.20
+++ apr_buckets_pool.c 2001/08/03 14:21:52 1.21
@@ -171,6 +171,7 @@
APU_DECLARE_DATA const apr_bucket_type_t apr_bucket_type_pool = {
"POOL", 5,
pool_destroy,
+ free,
pool_read,
apr_bucket_setaside_noop,
apr_bucket_shared_split,
1.31 +2 -0 apr-util/buckets/apr_buckets_simple.c
Index: apr_buckets_simple.c
===================================================================
RCS file: /home/cvs/apr-util/buckets/apr_buckets_simple.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- apr_buckets_simple.c 2001/07/24 20:36:03 1.30
+++ apr_buckets_simple.c 2001/08/03 14:21:52 1.31
@@ -158,6 +158,7 @@
const apr_bucket_type_t apr_bucket_type_immortal = {
"IMMORTAL", 5,
apr_bucket_destroy_noop,
+ free,
simple_read,
apr_bucket_setaside_noop,
apr_bucket_simple_split,
@@ -167,6 +168,7 @@
APU_DECLARE_DATA const apr_bucket_type_t apr_bucket_type_transient = {
"TRANSIENT", 5,
apr_bucket_destroy_noop,
+ free,
simple_read,
transient_setaside,
apr_bucket_simple_split,
1.27 +1 -0 apr-util/buckets/apr_buckets_socket.c
Index: apr_buckets_socket.c
===================================================================
RCS file: /home/cvs/apr-util/buckets/apr_buckets_socket.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- apr_buckets_socket.c 2001/07/24 20:36:03 1.26
+++ apr_buckets_socket.c 2001/08/03 14:21:52 1.27
@@ -148,6 +148,7 @@
APU_DECLARE_DATA const apr_bucket_type_t apr_bucket_type_socket = {
"SOCKET", 5,
apr_bucket_destroy_noop,
+ free,
socket_read,
apr_bucket_setaside_notimpl,
apr_bucket_split_notimpl,
1.104 +10 -1 apr-util/include/apr_buckets.h
Index: apr_buckets.h
===================================================================
RCS file: /home/cvs/apr-util/include/apr_buckets.h,v
retrieving revision 1.103
retrieving revision 1.104
diff -u -r1.103 -r1.104
--- apr_buckets.h 2001/07/24 20:36:03 1.103
+++ apr_buckets.h 2001/08/03 14:21:52 1.104
@@ -164,6 +164,15 @@
void (*destroy)(void *data);
/**
+ * Pointer to function used to free the bucket. This function should
+ * always be defined and it should be consistent with the memory
+ * function used to allocate the bucket. For example, if malloc() is
+ * used to allocate the bucket, this pointer should point to free().
+ * @param e Pointer to the bucket being freed
+ */
+ void (*free)(void *e);
+
+ /**
* Read the data from the bucket. This is guaranteed to be implemented
* for all bucket types.
* @param b The bucket to read from
@@ -778,7 +787,7 @@
*/
#define apr_bucket_destroy(e) do { \
(e)->type->destroy((e)->data);
\
- free(e); \
+ (e)->type->free(e); \
} while (0)
/**