diff options
author | mturk <mturk@13f79535-47bb-0310-9956-ffa450edef68> | 2008-07-10 05:44:08 +0000 |
---|---|---|
committer | mturk <mturk@13f79535-47bb-0310-9956-ffa450edef68> | 2008-07-10 05:44:08 +0000 |
commit | 9f4bc73da99fd3bac3df5ada45eab77f4bb2968d (patch) | |
tree | e88b26edb49f5f0f4e31fd28584d391c3949d059 | |
parent | 7a1b61d9f0a3d832f013b40b82cb7d53a12f3130 (diff) | |
download | libapr-9f4bc73da99fd3bac3df5ada45eab77f4bb2968d.tar.gz |
Backport r675117 from trunk
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.3.x@675448 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | CHANGES | 4 | ||||
-rw-r--r-- | include/apr_pools.h | 48 | ||||
-rw-r--r-- | memory/unix/apr_pools.c | 43 |
3 files changed, 85 insertions, 10 deletions
@@ -1,6 +1,10 @@ -*- coding: utf-8 -*- Changes for APR 1.3.3 + *) Rename apr_pool_create_core to apr_pool_create_unmanaged and + deprecate the old API name. It better reflects the scope and usage + of this function. [Mladen Turk] + *) Use proper return code for fcntl-based apr_proc_mutex_trylock() on platforms that return EACCES instead of EAGAIN when the lock is already held (AIX, HP-UX). diff --git a/include/apr_pools.h b/include/apr_pools.h index eb7c6e5b1..d28f6f9af 100644 --- a/include/apr_pools.h +++ b/include/apr_pools.h @@ -190,14 +190,26 @@ APR_DECLARE(apr_status_t) apr_pool_create_ex(apr_pool_t **newpool, /** * Create a new pool. + * @deprecated @see apr_pool_create_unmanaged_ex. + */ +APR_DECLARE(apr_status_t) apr_pool_create_core_ex(apr_pool_t **newpool, + apr_abortfunc_t abort_fn, + apr_allocator_t *allocator); + +/** + * Create a new unmanaged pool. * @param newpool The pool we have just created. * @param abort_fn A function to use if the pool cannot allocate more memory. * @param allocator The allocator to use with the new pool. If NULL the * new allocator will be crated with newpool as owner. + * @remark Unmanaged pool is special pool that does not have parent pool + * and is NOT destroyed upon apr_terminate call. + * It must be explicitly destroyed by calling apr_pool_destroy, + * otherwise the memory will leek. */ -APR_DECLARE(apr_status_t) apr_pool_create_core_ex(apr_pool_t **newpool, - apr_abortfunc_t abort_fn, - apr_allocator_t *allocator); +APR_DECLARE(apr_status_t) apr_pool_create_unmanaged_ex(apr_pool_t **newpool, + apr_abortfunc_t abort_fn, + apr_allocator_t *allocator); /** * Debug version of apr_pool_create_ex. @@ -229,20 +241,29 @@ APR_DECLARE(apr_status_t) apr_pool_create_ex_debug(apr_pool_t **newpool, /** * Debug version of apr_pool_create_core_ex. - * @param newpool @see apr_pool_create. - * @param abort_fn @see apr_pool_create. - * @param allocator @see apr_pool_create. + * @deprecated @see apr_pool_create_unmanaged_ex_debug. + */ +APR_DECLARE(apr_status_t) apr_pool_create_core_ex_debug(apr_pool_t **newpool, + apr_abortfunc_t abort_fn, + apr_allocator_t *allocator, + const char *file_line); + +/** + * Debug version of apr_pool_create_unmanaged_ex. + * @param newpool @see apr_pool_create_unmanaged. + * @param abort_fn @see apr_pool_create_unmanaged. + * @param allocator @see apr_pool_create_unmanaged. * @param file_line Where the function is called from. * This is usually APR_POOL__FILE_LINE__. * @remark Only available when APR_POOL_DEBUG is defined. - * Call this directly if you have you apr_pool_create_core_ex + * Call this directly if you have you apr_pool_create_unmanaged_ex * calls in a wrapper function and wish to override * the file_line argument to reflect the caller of * your wrapper function. If you do not have * apr_pool_create_core_ex in a wrapper, trust the macro * and don't call apr_pool_create_core_ex_debug directly. */ -APR_DECLARE(apr_status_t) apr_pool_create_core_ex_debug(apr_pool_t **newpool, +APR_DECLARE(apr_status_t) apr_pool_create_unmanaged_ex_debug(apr_pool_t **newpool, apr_abortfunc_t abort_fn, apr_allocator_t *allocator, const char *file_line); @@ -251,6 +272,11 @@ APR_DECLARE(apr_status_t) apr_pool_create_core_ex_debug(apr_pool_t **newpool, #define apr_pool_create_core_ex(newpool, abort_fn, allocator) \ apr_pool_create_core_ex_debug(newpool, abort_fn, allocator, \ APR_POOL__FILE_LINE__) + +#define apr_pool_create_unmanaged_ex(newpool, abort_fn, allocator) \ + apr_pool_create_unmanaged_ex_debug(newpool, abort_fn, allocator, \ + APR_POOL__FILE_LINE__) + #endif /** @@ -281,14 +307,20 @@ APR_DECLARE(apr_status_t) apr_pool_create(apr_pool_t **newpool, */ #if defined(DOXYGEN) APR_DECLARE(apr_status_t) apr_pool_create_core(apr_pool_t **newpool); +APR_DECLARE(apr_status_t) apr_pool_create_unmanaged(apr_pool_t **newpool); #else #if APR_POOL_DEBUG #define apr_pool_create_core(newpool) \ apr_pool_create_core_ex_debug(newpool, NULL, NULL, \ APR_POOL__FILE_LINE__) +#define apr_pool_create_unmanaged(newpool) \ + apr_pool_create_unmanaged_ex_debug(newpool, NULL, NULL, \ + APR_POOL__FILE_LINE__) #else #define apr_pool_create_core(newpool) \ apr_pool_create_core_ex(newpool, NULL, NULL) +#define apr_pool_create_unmanaged(newpool) \ + apr_pool_create_unmanaged_ex(newpool, NULL, NULL) #endif #endif diff --git a/memory/unix/apr_pools.c b/memory/unix/apr_pools.c index c080232e7..4612f0e63 100644 --- a/memory/unix/apr_pools.c +++ b/memory/unix/apr_pools.c @@ -907,10 +907,19 @@ APR_DECLARE(apr_status_t) apr_pool_create_ex(apr_pool_t **newpool, return APR_SUCCESS; } +/* Deprecated. Renamed to apr_pool_create_unmanaged_ex + */ APR_DECLARE(apr_status_t) apr_pool_create_core_ex(apr_pool_t **newpool, apr_abortfunc_t abort_fn, apr_allocator_t *allocator) { + return apr_pool_create_unmanaged_ex(newpool, abort_fn, allocator); +} + +APR_DECLARE(apr_status_t) apr_pool_create_unmanaged_ex(apr_pool_t **newpool, + apr_abortfunc_t abort_fn, + apr_allocator_t *allocator) +{ apr_pool_t *pool; apr_memnode_t *node; apr_allocator_t *pool_allocator; @@ -1731,6 +1740,15 @@ APR_DECLARE(apr_status_t) apr_pool_create_core_ex_debug(apr_pool_t **newpool, apr_allocator_t *allocator, const char *file_line) { + return apr_pool_create_unmanaged_ex_debug(newpool, abort_fn, allocator, + file_line); +} + +APR_DECLARE(apr_status_t) apr_pool_create_unmanaged_ex_debug(apr_pool_t **newpool, + apr_abortfunc_t abort_fn, + apr_allocator_t *allocator, + const char *file_line) +{ apr_pool_t *pool; apr_allocator_t *pool_allocator; @@ -2491,7 +2509,15 @@ APR_DECLARE(apr_status_t) apr_pool_create_core_ex_debug(apr_pool_t **newpool, apr_allocator_t *allocator, const char *file_line) { - return apr_pool_create_core_ex(newpool, abort_fn, allocator); + return apr_pool_create_unmanaged_ex(newpool, abort_fn, allocator); +} + +APR_DECLARE(apr_status_t) apr_pool_create_unmanaged_ex_debug(apr_pool_t **newpool, + apr_abortfunc_t abort_fn, + apr_allocator_t *allocator, + const char *file_line) +{ + return apr_pool_create_unmanaged_ex(newpool, abort_fn, allocator); } #else /* APR_POOL_DEBUG */ @@ -2553,7 +2579,20 @@ APR_DECLARE(apr_status_t) apr_pool_create_core_ex(apr_pool_t **newpool, apr_abortfunc_t abort_fn, apr_allocator_t *allocator) { - return apr_pool_create_core_ex_debug(newpool, abort_fn, + return apr_pool_create_unmanaged_ex_debug(newpool, abort_fn, + allocator, "undefined"); +} + +#undef apr_pool_create_unmanaged_ex +APR_DECLARE(apr_status_t) apr_pool_create_unmanaged_ex(apr_pool_t **newpool, + apr_abortfunc_t abort_fn, + apr_allocator_t *allocator); + +APR_DECLARE(apr_status_t) apr_pool_create_unmanaged_ex(apr_pool_t **newpool, + apr_abortfunc_t abort_fn, + apr_allocator_t *allocator) +{ + return apr_pool_create_unmanaged_ex_debug(newpool, abort_fn, allocator, "undefined"); } |