diff options
author | striker <striker@13f79535-47bb-0310-9956-ffa450edef68> | 2002-02-09 14:49:16 +0000 |
---|---|---|
committer | striker <striker@13f79535-47bb-0310-9956-ffa450edef68> | 2002-02-09 14:49:16 +0000 |
commit | cf2c6ddf2d0c674f3a8b2244050b454d7ed81834 (patch) | |
tree | 199e77679d0223f71736711a146107930115516d /memory | |
parent | 2a83c6801d3980cc2266813aa489825546f030bc (diff) | |
download | libapr-cf2c6ddf2d0c674f3a8b2244050b454d7ed81834.tar.gz |
Implement apr_pcalloc in terms of apr_palloc.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@62940 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'memory')
-rw-r--r-- | memory/unix/apr_pools.c | 31 |
1 files changed, 2 insertions, 29 deletions
diff --git a/memory/unix/apr_pools.c b/memory/unix/apr_pools.c index 7be2fff1e..029ea73aa 100644 --- a/memory/unix/apr_pools.c +++ b/memory/unix/apr_pools.c @@ -503,40 +503,13 @@ APR_DECLARE(void *) apr_palloc(apr_pool_t *pool, apr_size_t size) APR_DECLARE(void *) apr_pcalloc(apr_pool_t *pool, apr_size_t size) { - node_t *active, *node; void *mem; - char *endp; size = APR_ALIGN_DEFAULT(size); - active = pool->active; - - /* If the active node has enough bytes left, use it. */ - endp = active->first_avail + size; - if (endp < active->endp) { - mem = active->first_avail; - active->first_avail = endp; - + if ((mem = apr_palloc(pool, size)) != NULL) { memset(mem, 0, size); - - return mem; } - if ((node = node_malloc(pool->allocator, size)) == NULL) { - active->first_avail = active->endp; - - if (pool->abort_fn) - pool->abort_fn(APR_ENOMEM); - - return NULL; - } - - active->next = pool->active = node; - - mem = node->first_avail; - node->first_avail += size; - - memset(mem, 0, size); - return mem; } @@ -1427,7 +1400,7 @@ static int pool_find(apr_pool_t *pool, void *data) APR_DECLARE(apr_pool_t *) apr_pool_find(const void *mem) { - void *pool = mem; + void *pool = (void *)mem; if (apr_pool_walk_tree(global_pool, pool_find, &pool)) return pool; |