Skip to content

Commit 059434d

Browse files
committed
Add empty stubs for APR pool functions, that are
only needed when APR_POOL_DEBUG is defined, but can be aor should be called from app code. Providing stubs allows the app code to stay the same when running with or without debugging APR lib (no need for app recompilation). Backport of r1863217 from trunk resp. r1863234 from 1.7.x. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.6.x@1863235 13f79535-47bb-0310-9956-ffa450edef68
1 parent c34a31a commit 059434d

File tree

2 files changed

+27
-17
lines changed

2 files changed

+27
-17
lines changed

include/apr_pools.h

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -754,11 +754,12 @@ APR_DECLARE(void) apr_pool_cleanup_for_exec(void);
754754
* In this case the caller must call apr_pool_join() to indicate this
755755
* guarantee to the APR_POOL_DEBUG code.
756756
*
757-
* These functions are only implemented when #APR_POOL_DEBUG is set.
757+
* These functions have an empty implementation if APR is compiled
758+
* with #APR_POOL_DEBUG not set.
758759
*
759760
* @{
760761
*/
761-
#if APR_POOL_DEBUG || defined(DOXYGEN)
762+
762763
/**
763764
* Guarantee that a subpool has the same lifetime as the parent.
764765
* @param p The parent pool
@@ -792,20 +793,6 @@ APR_DECLARE(void) apr_pool_lock(apr_pool_t *pool, int flag);
792793

793794
/* @} */
794795

795-
#else /* APR_POOL_DEBUG or DOXYGEN */
796-
797-
#ifdef apr_pool_join
798-
#undef apr_pool_join
799-
#endif
800-
#define apr_pool_join(a,b)
801-
802-
#ifdef apr_pool_lock
803-
#undef apr_pool_lock
804-
#endif
805-
#define apr_pool_lock(pool, lock)
806-
807-
#endif /* APR_POOL_DEBUG or DOXYGEN */
808-
809796
/** @} */
810797

811798
#ifdef __cplusplus

memory/unix/apr_pools.c

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2834,13 +2834,13 @@ static void free_proc_chain(struct process_chain *procs)
28342834
}
28352835
}
28362836

2837+
#if !APR_POOL_DEBUG
28372838

28382839
/*
28392840
* Pool creation/destruction stubs, for people who are running
28402841
* mixed release/debug enviroments.
28412842
*/
28422843

2843-
#if !APR_POOL_DEBUG
28442844
APR_DECLARE(void *) apr_palloc_debug(apr_pool_t *pool, apr_size_t size,
28452845
const char *file_line)
28462846
{
@@ -2890,6 +2890,29 @@ APR_DECLARE(apr_status_t) apr_pool_create_unmanaged_ex_debug(apr_pool_t **newpoo
28902890
return apr_pool_create_unmanaged_ex(newpool, abort_fn, allocator);
28912891
}
28922892

2893+
/*
2894+
* Other stubs, for people who are running
2895+
* mixed release/debug enviroments.
2896+
*/
2897+
2898+
APR_DECLARE(void) apr_pool_join(apr_pool_t *p, apr_pool_t *sub)
2899+
{
2900+
}
2901+
2902+
APR_DECLARE(apr_pool_t *) apr_pool_find(const void *mem)
2903+
{
2904+
return NULL;
2905+
}
2906+
2907+
APR_DECLARE(apr_size_t) apr_pool_num_bytes(apr_pool_t *pool, int recurse)
2908+
{
2909+
return 0;
2910+
}
2911+
2912+
APR_DECLARE(void) apr_pool_lock(apr_pool_t *pool, int flag)
2913+
{
2914+
}
2915+
28932916
#else /* APR_POOL_DEBUG */
28942917

28952918
#undef apr_palloc

0 commit comments

Comments
 (0)