diff options
-rw-r--r-- | CHANGES | 2 | ||||
-rw-r--r-- | STATUS | 8 | ||||
-rw-r--r-- | include/apr_pools.h | 4 | ||||
-rw-r--r-- | memory/unix/apr_pools.c | 8 |
4 files changed, 15 insertions, 7 deletions
@@ -1,5 +1,7 @@ Changes with APR b1 + *) Converted apr_pcalloc to a macro [Brian Pane] + *) Fixed APR_STATUS_IS_ETIMEDOUT macro. [Dagfinn Aarvaag <dagfinn.aarvaag@beepscience.com>] @@ -1,5 +1,5 @@ APACHE PORTABLE RUNTIME (APR) LIBRARY STATUS: -*-text-*- -Last modified at [$Date: 2002/05/03 13:00:19 $] +Last modified at [$Date: 2002/05/05 02:06:48 $] Release: @@ -102,12 +102,6 @@ CURRENT VOTES: The other alternative for non-native support is maybe to turn it into a spin lock - * Turn apr_pcalloc into a macro that does apr_palloc+memset, to take - advantage of compiler optimizations when the size of the block being - passed to memset is known at compile time. - - +1: BrianP, Justin, Sander, Cliff, Ian, BillS - RELEASE NON-SHOWSTOPPERS BUT WOULD BE REAL NICE TO WRAP THESE UP: diff --git a/include/apr_pools.h b/include/apr_pools.h index 620578bd6..7165cdce9 100644 --- a/include/apr_pools.h +++ b/include/apr_pools.h @@ -384,7 +384,11 @@ APR_DECLARE(void *) apr_palloc_debug(apr_pool_t *p, apr_size_t size, * @param size The amount of memory to allocate * @return The allocated memory */ +#if defined(DOXYGEN) APR_DECLARE(void *) apr_pcalloc(apr_pool_t *p, apr_size_t size); +#else +#define apr_pcalloc(p, size) memset(apr_palloc(p, size), 0, size) +#endif /** * Debug version of apr_pcalloc diff --git a/memory/unix/apr_pools.c b/memory/unix/apr_pools.c index 35bf4b775..00d04ec35 100644 --- a/memory/unix/apr_pools.c +++ b/memory/unix/apr_pools.c @@ -572,6 +572,14 @@ APR_DECLARE(void *) apr_palloc(apr_pool_t *pool, apr_size_t size) return mem; } +/* Provide an implementation of apr_pcalloc for backward compatibility + * with code built before apr_pcalloc was a macro + */ + +#ifdef apr_pcalloc +#undef apr_pcalloc +#endif + APR_DECLARE(void *) apr_pcalloc(apr_pool_t *pool, apr_size_t size) { void *mem; |