diff options
author | jwoolley <jwoolley@13f79535-47bb-0310-9956-ffa450edef68> | 2002-03-29 08:12:08 +0000 |
---|---|---|
committer | jwoolley <jwoolley@13f79535-47bb-0310-9956-ffa450edef68> | 2002-03-29 08:12:08 +0000 |
commit | 29b6d4540c75f63070bd514c684f19efe410d87e (patch) | |
tree | 137a38691d4f2d00d9f7cbda5bac6b7894b572b4 /buckets/apr_buckets_mmap.c | |
parent | b7432f5f0174a646055dfbeace1e72511f455767 (diff) | |
download | libapr-util-29b6d4540c75f63070bd514c684f19efe410d87e.tar.gz |
BUCKET FREELISTS
Add an allocator-passing mechanism throughout the bucket brigades API.
This allows us to get away from malloc and free for the most part, which
will hopefully be a huge performance win.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr-util/trunk@58579 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'buckets/apr_buckets_mmap.c')
-rw-r--r-- | buckets/apr_buckets_mmap.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/buckets/apr_buckets_mmap.c b/buckets/apr_buckets_mmap.c index 4440e9ef..710d3c11 100644 --- a/buckets/apr_buckets_mmap.c +++ b/buckets/apr_buckets_mmap.c @@ -53,9 +53,6 @@ */ #include "apr_buckets.h" -#define APR_WANT_MEMFUNC -#include "apr_want.h" -#include <stdlib.h> #if APR_HAS_MMAP @@ -83,7 +80,7 @@ static void mmap_destroy(void *data) /* if we are the owner of the mmaped region, apr_mmap_delete will * munmap it for us. if we're not, it's essentially a noop. */ apr_mmap_delete(m->mmap); - free(m); + apr_bucket_free(m); } } @@ -96,10 +93,7 @@ APU_DECLARE(apr_bucket *) apr_bucket_mmap_make(apr_bucket *b, apr_mmap_t *mm, { apr_bucket_mmap *m; - m = malloc(sizeof(*m)); - if (m == NULL) { - return NULL; - } + m = apr_bucket_alloc(sizeof(*m), b->list); m->mmap = mm; b = apr_bucket_shared_make(b, m, start, length); @@ -111,12 +105,14 @@ APU_DECLARE(apr_bucket *) apr_bucket_mmap_make(apr_bucket *b, apr_mmap_t *mm, APU_DECLARE(apr_bucket *) apr_bucket_mmap_create(apr_mmap_t *mm, apr_off_t start, - apr_size_t length) + apr_size_t length, + apr_bucket_alloc_t *list) { - apr_bucket *b = (apr_bucket *)malloc(sizeof(*b)); + apr_bucket *b = apr_bucket_alloc(sizeof(*b), list); APR_BUCKET_INIT(b); - b->free = free; + b->free = apr_bucket_free; + b->list = list; return apr_bucket_mmap_make(b, mm, start, length); } |