apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sander Striker" <stri...@apache.org>
Subject RE: Passing file/line ALL the time WAS: RE: [PATCH] Default tagging of pools in debug mode [2]
Date Thu, 17 Jan 2002 14:48:22 GMT
Hi,

I believe this patch resolves OtherBills veto wrt
where the pools debug code was going.

The patch provides stubs for apr_pool_xxx_debug at
release time, ensuring binary compatibility.

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	17 Jan 2002 14:39:10 -0000
@@ -163,21 +163,37 @@
  *          (this flag only makes sense in combination with POOL_FNEW_ALLOCATOR)
  *
  */
-#if defined(APR_POOL_DEBUG)
-#define apr_pool_create_ex(newpool, parent, abort_fn, flag)  \
-    apr_pool_create_ex_debug(newpool, parent, abort_fn, flag, \
-                             APR_POOL__FILE_LINE__)
+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);
 
+/**
+ * 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.
+ */
 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);
+
+#if defined(APR_POOL_DEBUG)
+#define apr_pool_create_ex(newpool, parent, abort_fn, flag)  \
+    apr_pool_create_ex_debug(newpool, parent, abort_fn, flag, \
+                             APR_POOL__FILE_LINE__)
 #endif
 
 /**
@@ -234,14 +250,27 @@
  *       to re-use this memory for the next allocation.
  * @see apr_pool_destroy()
  */
-#if defined(APR_POOL_DEBUG)
-#define apr_pool_clear(p) \
-    apr_pool_clear_debug(p, APR_POOL__FILE_LINE__)
+APR_DECLARE(void) apr_pool_clear(apr_pool_t *p);
 
+/**
+ * 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.
+ */
 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);
+
+#if defined(APR_POOL_DEBUG)
+#define apr_pool_clear(p) \
+    apr_pool_clear_debug(p, APR_POOL__FILE_LINE__)
 #endif
 
 /**
@@ -250,14 +279,27 @@
  * @param p The pool to destroy
  * @remark This will actually free the memory
  */
-#if defined(APR_POOL_DEBUG)
-#define apr_pool_destroy(p) \
-    apr_pool_destroy_debug(p, APR_POOL__FILE_LINE__)
+APR_DECLARE(void) apr_pool_destroy(apr_pool_t *p);
 
+/**
+ * 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.
+ */
 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);
+
+#if defined(APR_POOL_DEBUG)
+#define apr_pool_destroy(p) \
+    apr_pool_destroy_debug(p, APR_POOL__FILE_LINE__)
 #endif
 
 
Index: memory/unix/apr_pools.c
===================================================================
RCS file: /home/cvs/apr/memory/unix/apr_pools.c,v
retrieving revision 1.139
diff -u -r1.139 apr_pools.c
--- memory/unix/apr_pools.c	15 Jan 2002 12:16:20 -0000	1.139
+++ memory/unix/apr_pools.c	17 Jan 2002 14:39:18 -0000
@@ -718,6 +718,32 @@
     return APR_SUCCESS;
 }
 
+/*
+ * Pool creation/destruction stubs, for people who are running 
+ * mixed release/debug enviroments.
+ */
+
+APR_DECLARE(void) apr_pool_clear_debug(apr_pool_t *pool,
+                                       const char *file_line)
+{
+    apr_pool_clear(pool);
+}
+
+APR_DECLARE(void) apr_pool_destroy_debug(apr_pool_t *pool,
+                                         const char *file_line)
+{
+    apr_pool_destroy(pool);
+}
+
+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)
+{
+    return apr_pool_create_ex(newpool, parent, abort_fn, flags);
+}
+
 
 /*
  * "Print" functions

Mime
View raw message