striker 02/01/24 05:41:17
Modified: include apr_pools.h
memory/unix apr_pools.c
Log:
Never consider a commit when you have limited time...
Fix for when not in debug mode.
Use the correct include file for getpid().
Comment the debug mode layout in the header.
Revision Changes Path
1.72 +41 -19 apr/include/apr_pools.h
Index: apr_pools.h
===================================================================
RCS file: /home/cvs/apr/include/apr_pools.h,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -r1.71 -r1.72
--- apr_pools.h 18 Jan 2002 02:57:23 -0000 1.71
+++ apr_pools.h 24 Jan 2002 13:41:17 -0000 1.72
@@ -59,6 +59,8 @@
extern "C" {
#endif
+
+
/**
* @file apr_pools.h
* @brief APR memory allocation
@@ -85,22 +87,42 @@
#define APR_WANT_MEMFUNC
#include "apr_want.h"
-/* Memory allocation/Pool debugging options...
+/**
+ * Pool debug levels
*
- * Look in the developer documentation for details of what these do.
+ * | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
+ * ---------------------------------
+ * | | | | | | | | x | General debug code enabled (good for
--with-efence)
+ *
+ * | | | | | | | x | | Verbose output on stderr (report
CREATE, CLEAR, DESTROY)
+ *
+ * | | | | | | x | | | Lifetime checking. On each use of a
pool, check its lifetime.
+ * If the pool is out of scope, abort().
In combination with
+ * the verbose flag above, it will output
LIFE in such an event
+ * prior to aborting.
+ *
+ * | | | | | x | | | | Pool owner checking. On each use of a
pool, check if the
+ * current thread is the pools owner. If
not, abort(). In
+ * combination with the verbose flag
above, it will output OWNER
+ * in such an event prior to aborting.
Use the debug function
+ * apr_pool_set_owner() to switch a pools
ownership.
*
- * NB These should ALL normally be commented out unless you REALLY
- * need them!!
+ * When no debug level was specified, assume general debug mode.
+ * If level 0 was specified, debugging is switched off
*/
-/*
-#define APR_POOL_DEBUG
-#define APR_POOL_DEBUG_VERBOSE
-*/
-
-#if defined(APR_POOL_DEBUG_VERBOSE) && !defined(APR_POOL_DEBUG)
-#define APR_POOL_DEBUG
-#endif
-
+#if defined(APR_POOL_DEBUG)
+# if (APR_POOL_DEBUG != 0) && (APR_POOL_DEBUG - 0 == 0)
+# undef APR_POOL_DEBUG
+# define APR_POOL_DEBUG 1
+# endif
+# if APR_POOL_DEBUG == 0
+# undef APR_POOL_DEBUG
+# define APR_POOL_DEBUG 1
+# endif
+#else
+# define APR_POOL_DEBUG 0
+#endif
+
#define APR_POOL_STRINGIZE(x) APR_POOL__STRINGIZE(x)
#define APR_POOL__STRINGIZE(x) #x
#define APR_POOL__FILE_LINE__ __FILE__ ":" APR_POOL_STRINGIZE(__LINE__)
@@ -190,7 +212,7 @@
apr_uint32_t flags,
const char *file_line);
-#if defined(APR_POOL_DEBUG)
+#if 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__)
@@ -208,7 +230,7 @@
APR_DECLARE(apr_status_t) apr_pool_create(apr_pool_t **newpool,
apr_pool_t *parent);
#else
-#if defined(APR_POOL_DEBUG)
+#if APR_POOL_DEBUG
#define apr_pool_create(newpool, parent) \
apr_pool_create_ex_debug(newpool, parent, NULL, APR_POOL_FDEFAULT, \
APR_POOL__FILE_LINE__)
@@ -231,7 +253,7 @@
apr_pool_t *parent,
int (*apr_abort)(int retcode));
#else
-#if defined(APR_POOL_DEBUG)
+#if APR_POOL_DEBUG
#define apr_pool_sub_make(newpool, parent, abort_fn) \
(void)apr_pool_create_ex_debug(newpool, parent, abort_fn, \
APR_POOL_FDEFAULT, \
@@ -268,7 +290,7 @@
APR_DECLARE(void) apr_pool_clear_debug(apr_pool_t *p,
const char *file_line);
-#if defined(APR_POOL_DEBUG)
+#if APR_POOL_DEBUG
#define apr_pool_clear(p) \
apr_pool_clear_debug(p, APR_POOL__FILE_LINE__)
#endif
@@ -297,7 +319,7 @@
APR_DECLARE(void) apr_pool_destroy_debug(apr_pool_t *p,
const char *file_line);
-#if defined(APR_POOL_DEBUG)
+#if APR_POOL_DEBUG
#define apr_pool_destroy(p) \
apr_pool_destroy_debug(p, APR_POOL__FILE_LINE__)
#endif
@@ -532,7 +554,7 @@
*
* @{
*/
-#if defined(APR_POOL_DEBUG) || defined(DOXYGEN)
+#if APR_POOL_DEBUG || defined(DOXYGEN)
/**
* Guarantee that a subpool has the same lifetime as the parent.
* @param p The parent pool
1.143 +1 -14 apr/memory/unix/apr_pools.c
Index: apr_pools.c
===================================================================
RCS file: /home/cvs/apr/memory/unix/apr_pools.c,v
retrieving revision 1.142
retrieving revision 1.143
diff -u -r1.142 -r1.143
--- apr_pools.c 24 Jan 2002 12:18:18 -0000 1.142
+++ apr_pools.c 24 Jan 2002 13:41:17 -0000 1.143
@@ -56,6 +56,7 @@
#include "apr_private.h"
#include "apr_portable.h" /* for get_os_proc */
+#include "apr_thread_proc.h" /* for getpid */
#include "apr_strings.h"
#include "apr_general.h"
#include "apr_pools.h"
@@ -70,8 +71,6 @@
#include <stdlib.h> /* for malloc, free and abort */
#endif
-#include <unistd.h> /* for getpid */
-
/*
* Debug level
@@ -82,18 +81,6 @@
#define APR_POOL_DEBUG_LIFETIME 0x04
#define APR_POOL_DEBUG_OWNER 0x08
-/* When no level was specified, assume APR_POOL_DEBUG_GENERAL */
-#if defined(APR_POOL_DEBUG) && (APR_POOL_DEBUG != 0) && (APR_POOL_DEBUG - 0
== 0)
-#undef APR_POOL_DEBUG
-#define APR_POOL_DEBUG APR_POOL_DEBUG_GENERAL
-#endif
-
-/* We don't have debug level 0, assume APR_POOL_DEBUG_GENERAL. */
-#if APR_POOL_DEBUG == 0
-#undef APR_POOL_DEBUG
-#define APR_POOL_DEBUG APR_POOL_DEBUG_GENERAL
-#endif
-
/*
* Magic numbers