summaryrefslogtreecommitdiff
path: root/buckets/apr_buckets_mmap.c
diff options
context:
space:
mode:
authorjwoolley <jwoolley@13f79535-47bb-0310-9956-ffa450edef68>2001-08-25 22:54:56 +0000
committerjwoolley <jwoolley@13f79535-47bb-0310-9956-ffa450edef68>2001-08-25 22:54:56 +0000
commit3d7031819b868f081d5f1acb5cce3ac1178b9cc8 (patch)
tree777e4ec746ff29915aceccd923c1dace89e9fd3d /buckets/apr_buckets_mmap.c
parentdcae4e9f41ecb1f65347b95f822540e8efa03f8d (diff)
downloadlibapr-util-3d7031819b868f081d5f1acb5cce3ac1178b9cc8.tar.gz
BUCKETS SMS PHASE 1
s/malloc/apr_sms_malloc/; s/free/apr_sms_free/; Add in a temporary global apr_sms_std instance in the buckets code that all buckets will use to get their memory from. Add an apr_sms_t* to the apr_bucket struct and various private structures so that the apr_bucket_foo_make() functions and the foo_destroy() functions know which SMS to use. No API changes yet. git-svn-id: http://svn.apache.org/repos/asf/apr/apr-util/trunk@58403 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'buckets/apr_buckets_mmap.c')
-rw-r--r--buckets/apr_buckets_mmap.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/buckets/apr_buckets_mmap.c b/buckets/apr_buckets_mmap.c
index c8eebfcc..4c8a8008 100644
--- a/buckets/apr_buckets_mmap.c
+++ b/buckets/apr_buckets_mmap.c
@@ -55,7 +55,6 @@
#include "apr_buckets.h"
#define APR_WANT_MEMFUNC
#include "apr_want.h"
-#include <stdlib.h>
#if APR_HAS_MMAP
@@ -82,7 +81,7 @@ static void mmap_destroy(void *data)
if (apr_bucket_shared_destroy(m)) {
/* no need to apr_mmap_delete(m->mmap) here... it will
* get done automatically when the pool gets cleaned up. */
- free(m);
+ apr_sms_free(m->sms, m);
}
}
@@ -94,14 +93,12 @@ APU_DECLARE(apr_bucket *) apr_bucket_mmap_make(apr_bucket *b,
{
apr_bucket_mmap *m;
- m = malloc(sizeof(*m));
- if (m == NULL) {
- return NULL;
- }
+ m = (apr_bucket_mmap *)apr_sms_malloc(b->sms, sizeof(*m));
m->mmap = mm;
+ m->sms = b->sms;
- b = apr_bucket_shared_make(b, m, start, length);
- b->type = &apr_bucket_type_mmap;
+ apr_bucket_shared_make(b, m, start, length);
+ b->type = &apr_bucket_type_mmap;
return b;
}
@@ -110,10 +107,16 @@ APU_DECLARE(apr_bucket *) apr_bucket_mmap_make(apr_bucket *b,
APU_DECLARE(apr_bucket *) apr_bucket_mmap_create(
apr_mmap_t *mm, apr_off_t start, apr_size_t length)
{
- apr_bucket *b = (apr_bucket *)malloc(sizeof(*b));
+ apr_sms_t *sms;
+ apr_bucket *b;
+ if (!apr_bucket_global_sms) {
+ apr_sms_std_create(&apr_bucket_global_sms);
+ }
+ sms = apr_bucket_global_sms;
+ b = (apr_bucket *)apr_sms_malloc(sms, sizeof(*b));
APR_BUCKET_INIT(b);
- b->free = free;
+ b->sms = sms;
return apr_bucket_mmap_make(b, mm, start, length);
}
@@ -136,7 +139,7 @@ static apr_status_t mmap_setaside(apr_bucket *data, apr_pool_t *p)
base = apr_palloc(p, data->length);
memcpy(base, addr, data->length);
- data = apr_bucket_pool_make(data, base, data->length, p);
+ apr_bucket_pool_make(data, base, data->length, p);
mmap_destroy(m);
return APR_SUCCESS;