summaryrefslogtreecommitdiff
path: root/buckets/apr_buckets_heap.c
diff options
context:
space:
mode:
authorrbb <rbb@13f79535-47bb-0310-9956-ffa450edef68>2000-10-15 18:15:10 +0000
committerrbb <rbb@13f79535-47bb-0310-9956-ffa450edef68>2000-10-15 18:15:10 +0000
commit81bea7f02d7eb169535d38bc8a0079234fdc95bf (patch)
tree19c16ca883e8ac05f58dffaa86a8048ff23e98b3 /buckets/apr_buckets_heap.c
parent1222e22d97292b7bdb17254c45e0b43ad7763b4a (diff)
downloadlibapr-util-81bea7f02d7eb169535d38bc8a0079234fdc95bf.tar.gz
Stop using the index into the array for the bucket type. Now we just use
a pointer to a static structure. The ap_foo_type functions have also been replaced with simple macro calls. I am going to replace the ap_bucket_(read|split|setaside|destroy) functions with macros soon. Reviewed by: Will Rowe git-svn-id: http://svn.apache.org/repos/asf/apr/apr-util/trunk@57893 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'buckets/apr_buckets_heap.c')
-rw-r--r--buckets/apr_buckets_heap.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/buckets/apr_buckets_heap.c b/buckets/apr_buckets_heap.c
index 21f7edb0..f0635f02 100644
--- a/buckets/apr_buckets_heap.c
+++ b/buckets/apr_buckets_heap.c
@@ -56,7 +56,6 @@
#include "ap_buckets.h"
#include <stdlib.h>
-static int heap_type;
/*
* The size of heap bucket memory allocations.
* XXX: This is currently a guess and should be adjusted to an
@@ -89,6 +88,9 @@ static void heap_destroy(void *data)
free(h);
}
+ap_bucket_type ap_heap_type = { "HEAP", 4, heap_destroy, heap_read,
+ ap_bucket_setaside_notimpl, ap_bucket_split_shared };
+
API_EXPORT(ap_bucket *) ap_bucket_make_heap(ap_bucket *b,
const char *buf, apr_size_t length, int copy, apr_ssize_t *w)
{
@@ -128,7 +130,7 @@ API_EXPORT(ap_bucket *) ap_bucket_make_heap(ap_bucket *b,
return NULL;
}
- b->type = heap_type;
+ b->type = &ap_heap_type;
if (w)
*w = length;
@@ -144,17 +146,6 @@ API_EXPORT(ap_bucket *) ap_bucket_create_heap(
void ap_bucket_heap_register(apr_pool_t *p)
{
- ap_bucket_type type;
-
- type.split = ap_bucket_split_shared;
- type.destroy = heap_destroy;
- type.read = heap_read;
- type.setaside = NULL;
-
- heap_type = ap_insert_bucket_type(&type);
+ ap_insert_bucket_type(&ap_heap_type);
}
-int ap_heap_type(void)
-{
- return heap_type;
-}