summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRainer Jung <rjung@apache.org>2019-07-17 19:04:43 +0000
committerRainer Jung <rjung@apache.org>2019-07-17 19:04:43 +0000
commit682f0d6d094af44f2d4bce02504504b7cb0d4fd0 (patch)
treed847b36315227723139086eab6f28f2314144fe3
parent48d64b177f569542e840aaa7a476beb65bbef1aa (diff)
downloadapr-682f0d6d094af44f2d4bce02504504b7cb0d4fd0.tar.gz
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. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1863234 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--include/apr_pools.h19
-rw-r--r--memory/unix/apr_pools.c25
2 files changed, 27 insertions, 17 deletions
diff --git a/include/apr_pools.h b/include/apr_pools.h
index 783c9c422..eadc22773 100644
--- a/include/apr_pools.h
+++ b/include/apr_pools.h
@@ -754,11 +754,12 @@ APR_DECLARE(void) apr_pool_cleanup_for_exec(void);
* In this case the caller must call apr_pool_join() to indicate this
* guarantee to the APR_POOL_DEBUG code.
*
- * These functions are only implemented when #APR_POOL_DEBUG is set.
+ * These functions have an empty implementation if APR is compiled
+ * with #APR_POOL_DEBUG not set.
*
* @{
*/
-#if APR_POOL_DEBUG || defined(DOXYGEN)
+
/**
* Guarantee that a subpool has the same lifetime as the parent.
* @param p The parent pool
@@ -792,20 +793,6 @@ APR_DECLARE(void) apr_pool_lock(apr_pool_t *pool, int flag);
/* @} */
-#else /* APR_POOL_DEBUG or DOXYGEN */
-
-#ifdef apr_pool_join
-#undef apr_pool_join
-#endif
-#define apr_pool_join(a,b)
-
-#ifdef apr_pool_lock
-#undef apr_pool_lock
-#endif
-#define apr_pool_lock(pool, lock)
-
-#endif /* APR_POOL_DEBUG or DOXYGEN */
-
/** @} */
#ifdef __cplusplus
diff --git a/memory/unix/apr_pools.c b/memory/unix/apr_pools.c
index a59d9dac2..82c7c5041 100644
--- a/memory/unix/apr_pools.c
+++ b/memory/unix/apr_pools.c
@@ -2834,13 +2834,13 @@ static void free_proc_chain(struct process_chain *procs)
}
}
+#if !APR_POOL_DEBUG
/*
* Pool creation/destruction stubs, for people who are running
* mixed release/debug enviroments.
*/
-#if !APR_POOL_DEBUG
APR_DECLARE(void *) apr_palloc_debug(apr_pool_t *pool, apr_size_t size,
const char *file_line)
{
@@ -2890,6 +2890,29 @@ APR_DECLARE(apr_status_t) apr_pool_create_unmanaged_ex_debug(apr_pool_t **newpoo
return apr_pool_create_unmanaged_ex(newpool, abort_fn, allocator);
}
+/*
+ * Other stubs, for people who are running
+ * mixed release/debug enviroments.
+ */
+
+APR_DECLARE(void) apr_pool_join(apr_pool_t *p, apr_pool_t *sub)
+{
+}
+
+APR_DECLARE(apr_pool_t *) apr_pool_find(const void *mem)
+{
+ return NULL;
+}
+
+APR_DECLARE(apr_size_t) apr_pool_num_bytes(apr_pool_t *pool, int recurse)
+{
+ return 0;
+}
+
+APR_DECLARE(void) apr_pool_lock(apr_pool_t *pool, int flag)
+{
+}
+
#else /* APR_POOL_DEBUG */
#undef apr_palloc