diff options
author | jwoolley <jwoolley@13f79535-47bb-0310-9956-ffa450edef68> | 2002-04-01 05:42:38 +0000 |
---|---|---|
committer | jwoolley <jwoolley@13f79535-47bb-0310-9956-ffa450edef68> | 2002-04-01 05:42:38 +0000 |
commit | 962f70312e211822806605e2591e85da259a4a77 (patch) | |
tree | b722477ed6441358bbf001d9fd95c918d87e62c8 | |
parent | 3a2a5c61afd1cdbb86a4e3aff913f75073f9578f (diff) | |
download | libapr-962f70312e211822806605e2591e85da259a4a77.tar.gz |
Minor tweaks to expose things in the apr_allocator API needed to implement
the bucket allocator in apr-util
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@63209 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | include/apr_allocator.h | 9 | ||||
-rw-r--r-- | memory/unix/apr_pools.c | 23 |
2 files changed, 14 insertions, 18 deletions
diff --git a/include/apr_allocator.h b/include/apr_allocator.h index 934c7c8b2..a2d2aa1bb 100644 --- a/include/apr_allocator.h +++ b/include/apr_allocator.h @@ -85,6 +85,15 @@ typedef struct apr_allocator_t apr_allocator_t; /** the structure which holds information about the allocation */ typedef struct apr_memnode_t apr_memnode_t; +struct apr_memnode_t { + apr_memnode_t *next; + apr_uint32_t index; + char *first_avail; + char *endp; +}; + +#define APR_MEMNODE_T_SIZE APR_ALIGN_DEFAULT(sizeof(apr_memnode_t)) + /** * Create a new allocator * @param allocator The allocator we have just created. diff --git a/memory/unix/apr_pools.c b/memory/unix/apr_pools.c index 18fc8f2db..35bf4b775 100644 --- a/memory/unix/apr_pools.c +++ b/memory/unix/apr_pools.c @@ -77,19 +77,6 @@ /* - * XXX: Memory node struct, move to private header file - */ -struct apr_memnode_t { - apr_memnode_t *next; - apr_uint32_t index; - char *first_avail; - char *endp; -}; - -#define SIZEOF_MEMNODE_T APR_ALIGN_DEFAULT(sizeof(apr_memnode_t)) - - -/* * Magic numbers */ @@ -189,7 +176,7 @@ APR_DECLARE(apr_memnode_t *) apr_allocator_alloc(apr_allocator_t *allocator, /* Round up the block size to the next boundary, but always * allocate at least a certain size (MIN_ALLOC). */ - size = APR_ALIGN(size + SIZEOF_MEMNODE_T, BOUNDARY_SIZE); + size = APR_ALIGN(size + APR_MEMNODE_T_SIZE, BOUNDARY_SIZE); if (size < MIN_ALLOC) size = MIN_ALLOC; @@ -247,7 +234,7 @@ APR_DECLARE(apr_memnode_t *) apr_allocator_alloc(apr_allocator_t *allocator, #endif /* APR_HAS_THREADS */ node->next = NULL; - node->first_avail = (char *)node + SIZEOF_MEMNODE_T; + node->first_avail = (char *)node + APR_MEMNODE_T_SIZE; return node; } @@ -283,7 +270,7 @@ APR_DECLARE(apr_memnode_t *) apr_allocator_alloc(apr_allocator_t *allocator, #endif /* APR_HAS_THREADS */ node->next = NULL; - node->first_avail = (char *)node + SIZEOF_MEMNODE_T; + node->first_avail = (char *)node + APR_MEMNODE_T_SIZE; return node; } @@ -302,7 +289,7 @@ APR_DECLARE(apr_memnode_t *) apr_allocator_alloc(apr_allocator_t *allocator, node->next = NULL; node->index = index; - node->first_avail = (char *)node + SIZEOF_MEMNODE_T; + node->first_avail = (char *)node + APR_MEMNODE_T_SIZE; node->endp = (char *)node + size; return node; @@ -721,7 +708,7 @@ APR_DECLARE(apr_status_t) apr_pool_create_ex(apr_pool_t **newpool, allocator = parent->allocator; if ((node = apr_allocator_alloc(allocator, - MIN_ALLOC - SIZEOF_MEMNODE_T)) == NULL) { + MIN_ALLOC - APR_MEMNODE_T_SIZE)) == NULL) { if (abort_fn) abort_fn(APR_ENOMEM); |