Hi,
Projects that are always calling apr_pool_create,
clear or destroy from a wrapper and have a debug
version of that wrapper could benefit from this
patch. One project directly comes to mind:
subversion.
Exporting the apr_pool_xxx_debug functions (which
technically is already happening) will remove
code duplication in debug versions of wrappers.
Sander
Index: include/apr_pools.h
===================================================================
RCS file: /home/cvs/apr/include/apr_pools.h,v
retrieving revision 1.70
diff -u -r1.70 apr_pools.h
--- include/apr_pools.h 13 Jan 2002 18:46:24 -0000 1.70
+++ include/apr_pools.h 15 Jan 2002 12:40:30 -0000
@@ -167,17 +167,35 @@
#define apr_pool_create_ex(newpool, parent, abort_fn, flag) \
apr_pool_create_ex_debug(newpool, parent, abort_fn, flag, \
APR_POOL__FILE_LINE__)
+#else
+APR_DECLARE(apr_status_t) apr_pool_create_ex(apr_pool_t **newpool,
+ apr_pool_t *parent,
+ apr_abortfunc_t abort_fn,
+ apr_uint32_t flags);
+#endif
+/**
+ * Debug version of apr_pool_create_ex.
+ * @param newpool See: apr_pool_create.
+ * @param parent See: apr_pool_create.
+ * @param abort_fn See: apr_pool_create.
+ * @param flags See: apr_pool_create.
+ * @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_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_ex in a wrapper, trust the macro
+ * and don't call apr_pool_create_ex_debug directly.
+ */
+#if defined(APR_POOL_DEBUG) || defined(DOXYGEN)
APR_DECLARE(apr_status_t) apr_pool_create_ex_debug(apr_pool_t **newpool,
apr_pool_t *parent,
apr_abortfunc_t abort_fn,
apr_uint32_t flags,
const char *file_line);
-#else
-APR_DECLARE(apr_status_t) apr_pool_create_ex(apr_pool_t **newpool,
- apr_pool_t *parent,
- apr_abortfunc_t abort_fn,
- apr_uint32_t flags);
#endif
/**
@@ -237,11 +255,26 @@
#if defined(APR_POOL_DEBUG)
#define apr_pool_clear(p) \
apr_pool_clear_debug(p, APR_POOL__FILE_LINE__)
+#else
+APR_DECLARE(void) apr_pool_clear(apr_pool_t *p);
+#endif
+/**
+ * Debug version of apr_pool_clear.
+ * @param p See: apr_pool_clear.
+ * @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_clear
+ * 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_clear in a wrapper, trust the macro
+ * and don't call apr_pool_destroy_clear directly.
+ */
+#if defined(APR_POOL_DEBUG) || defined(DOXYGEN)
APR_DECLARE(void) apr_pool_clear_debug(apr_pool_t *p,
const char *file_line);
-#else
-APR_DECLARE(void) apr_pool_clear(apr_pool_t *p);
#endif
/**
@@ -253,11 +286,26 @@
#if defined(APR_POOL_DEBUG)
#define apr_pool_destroy(p) \
apr_pool_destroy_debug(p, APR_POOL__FILE_LINE__)
+#else
+APR_DECLARE(void) apr_pool_destroy(apr_pool_t *p);
+#endif
+/**
+ * Debug version of apr_pool_destroy.
+ * @param p See: apr_pool_destroy.
+ * @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_destroy
+ * 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_destroy in a wrapper, trust the macro
+ * and don't call apr_pool_destroy_debug directly.
+ */
+#if defined(APR_POOL_DEBUG) || defined(DOXYGEN)
APR_DECLARE(void) apr_pool_destroy_debug(apr_pool_t *p,
const char *file_line);
-#else
-APR_DECLARE(void) apr_pool_destroy(apr_pool_t *p);
#endif