apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r675448 - in /apr/apr/branches/1.3.x: CHANGES include/apr_pools.h memory/unix/apr_pools.c
Date Thu, 10 Jul 2008 05:44:08 GMT
Author: mturk
Date: Wed Jul  9 22:44:08 2008
New Revision: 675448

URL: http://svn.apache.org/viewvc?rev=675448&view=rev
Log:
Backport r675117 from trunk

Modified:
    apr/apr/branches/1.3.x/CHANGES
    apr/apr/branches/1.3.x/include/apr_pools.h
    apr/apr/branches/1.3.x/memory/unix/apr_pools.c

Modified: apr/apr/branches/1.3.x/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.3.x/CHANGES?rev=675448&r1=675447&r2=675448&view=diff
==============================================================================
--- apr/apr/branches/1.3.x/CHANGES [utf-8] (original)
+++ apr/apr/branches/1.3.x/CHANGES [utf-8] Wed Jul  9 22:44:08 2008
@@ -1,6 +1,10 @@
                                                      -*- coding: utf-8 -*-
 Changes for APR 1.3.3
 
+  *) Rename apr_pool_create_core to apr_pool_create_unmanaged and
+     deprecate the old API name. It better reflects the scope and usage
+     of this function. [Mladen Turk]
+
   *) Use proper return code for fcntl-based apr_proc_mutex_trylock() 
      on platforms that return EACCES instead of EAGAIN when the lock
      is already held (AIX, HP-UX).

Modified: apr/apr/branches/1.3.x/include/apr_pools.h
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.3.x/include/apr_pools.h?rev=675448&r1=675447&r2=675448&view=diff
==============================================================================
--- apr/apr/branches/1.3.x/include/apr_pools.h (original)
+++ apr/apr/branches/1.3.x/include/apr_pools.h Wed Jul  9 22:44:08 2008
@@ -190,14 +190,26 @@
 
 /**
  * Create a new pool.
+ * @deprecated @see apr_pool_create_unmanaged_ex.
+ */
+APR_DECLARE(apr_status_t) apr_pool_create_core_ex(apr_pool_t **newpool,
+                                                  apr_abortfunc_t abort_fn,
+                                                  apr_allocator_t *allocator);
+
+/**
+ * Create a new unmanaged pool.
  * @param newpool The pool we have just created.
  * @param abort_fn A function to use if the pool cannot allocate more memory.
  * @param allocator The allocator to use with the new pool.  If NULL the
  *        new allocator will be crated with newpool as owner.
+ * @remark Unmanaged pool is special pool that does not have parent pool
+ *         and is NOT destroyed upon apr_terminate call.
+ *         It must be explicitly destroyed by calling apr_pool_destroy,
+ *         otherwise the memory will leek.
  */
-APR_DECLARE(apr_status_t) apr_pool_create_core_ex(apr_pool_t **newpool,
-                                                  apr_abortfunc_t abort_fn,
-                                                  apr_allocator_t *allocator);
+APR_DECLARE(apr_status_t) apr_pool_create_unmanaged_ex(apr_pool_t **newpool,
+                                                   apr_abortfunc_t abort_fn,
+                                                   apr_allocator_t *allocator);
 
 /**
  * Debug version of apr_pool_create_ex.
@@ -229,20 +241,29 @@
 
 /**
  * Debug version of apr_pool_create_core_ex.
- * @param newpool @see apr_pool_create.
- * @param abort_fn @see apr_pool_create.
- * @param allocator @see apr_pool_create.
+ * @deprecated @see apr_pool_create_unmanaged_ex_debug.
+ */
+APR_DECLARE(apr_status_t) apr_pool_create_core_ex_debug(apr_pool_t **newpool,
+                                                   apr_abortfunc_t abort_fn,
+                                                   apr_allocator_t *allocator,
+                                                   const char *file_line);
+
+/**
+ * Debug version of apr_pool_create_unmanaged_ex.
+ * @param newpool @see apr_pool_create_unmanaged.
+ * @param abort_fn @see apr_pool_create_unmanaged.
+ * @param allocator @see apr_pool_create_unmanaged.
  * @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_core_ex
+ *         Call this directly if you have you apr_pool_create_unmanaged_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_core_ex in a wrapper, trust the macro
  *         and don't call apr_pool_create_core_ex_debug directly.
  */
-APR_DECLARE(apr_status_t) apr_pool_create_core_ex_debug(apr_pool_t **newpool,
+APR_DECLARE(apr_status_t) apr_pool_create_unmanaged_ex_debug(apr_pool_t **newpool,
                                                    apr_abortfunc_t abort_fn,
                                                    apr_allocator_t *allocator,
                                                    const char *file_line);
@@ -251,6 +272,11 @@
 #define apr_pool_create_core_ex(newpool, abort_fn, allocator)  \
     apr_pool_create_core_ex_debug(newpool, abort_fn, allocator, \
                                   APR_POOL__FILE_LINE__)
+
+#define apr_pool_create_unmanaged_ex(newpool, abort_fn, allocator)  \
+    apr_pool_create_unmanaged_ex_debug(newpool, abort_fn, allocator, \
+                                  APR_POOL__FILE_LINE__)
+
 #endif
 
 /**
@@ -281,14 +307,20 @@
  */
 #if defined(DOXYGEN)
 APR_DECLARE(apr_status_t) apr_pool_create_core(apr_pool_t **newpool);
+APR_DECLARE(apr_status_t) apr_pool_create_unmanaged(apr_pool_t **newpool);
 #else
 #if APR_POOL_DEBUG
 #define apr_pool_create_core(newpool) \
     apr_pool_create_core_ex_debug(newpool, NULL, NULL, \
                                   APR_POOL__FILE_LINE__)
+#define apr_pool_create_unmanaged(newpool) \
+    apr_pool_create_unmanaged_ex_debug(newpool, NULL, NULL, \
+                                  APR_POOL__FILE_LINE__)
 #else
 #define apr_pool_create_core(newpool) \
     apr_pool_create_core_ex(newpool, NULL, NULL)
+#define apr_pool_create_unmanaged(newpool) \
+    apr_pool_create_unmanaged_ex(newpool, NULL, NULL)
 #endif
 #endif
 

Modified: apr/apr/branches/1.3.x/memory/unix/apr_pools.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.3.x/memory/unix/apr_pools.c?rev=675448&r1=675447&r2=675448&view=diff
==============================================================================
--- apr/apr/branches/1.3.x/memory/unix/apr_pools.c (original)
+++ apr/apr/branches/1.3.x/memory/unix/apr_pools.c Wed Jul  9 22:44:08 2008
@@ -907,10 +907,19 @@
     return APR_SUCCESS;
 }
 
+/* Deprecated. Renamed to apr_pool_create_unmanaged_ex
+ */
 APR_DECLARE(apr_status_t) apr_pool_create_core_ex(apr_pool_t **newpool,
                                                   apr_abortfunc_t abort_fn,
                                                   apr_allocator_t *allocator)
 {
+    return apr_pool_create_unmanaged_ex(newpool, abort_fn, allocator);
+}
+
+APR_DECLARE(apr_status_t) apr_pool_create_unmanaged_ex(apr_pool_t **newpool,
+                                                  apr_abortfunc_t abort_fn,
+                                                  apr_allocator_t *allocator)
+{
     apr_pool_t *pool;
     apr_memnode_t *node;
     apr_allocator_t *pool_allocator;
@@ -1731,6 +1740,15 @@
                                                    apr_allocator_t *allocator,
                                                    const char *file_line)
 {
+    return apr_pool_create_unmanaged_ex_debug(newpool, abort_fn, allocator,
+                                              file_line);
+}
+
+APR_DECLARE(apr_status_t) apr_pool_create_unmanaged_ex_debug(apr_pool_t **newpool,
+                                                   apr_abortfunc_t abort_fn,
+                                                   apr_allocator_t *allocator,
+                                                   const char *file_line)
+{
     apr_pool_t *pool;
     apr_allocator_t *pool_allocator;
 
@@ -2491,7 +2509,15 @@
                                                    apr_allocator_t *allocator,
                                                    const char *file_line)
 {
-    return apr_pool_create_core_ex(newpool, abort_fn, allocator);
+    return apr_pool_create_unmanaged_ex(newpool, abort_fn, allocator);
+}
+
+APR_DECLARE(apr_status_t) apr_pool_create_unmanaged_ex_debug(apr_pool_t **newpool,
+                                                   apr_abortfunc_t abort_fn,
+                                                   apr_allocator_t *allocator,
+                                                   const char *file_line)
+{
+    return apr_pool_create_unmanaged_ex(newpool, abort_fn, allocator);
 }
 
 #else /* APR_POOL_DEBUG */
@@ -2553,7 +2579,20 @@
                                                   apr_abortfunc_t abort_fn,
                                                   apr_allocator_t *allocator)
 {
-    return apr_pool_create_core_ex_debug(newpool, abort_fn,
+    return apr_pool_create_unmanaged_ex_debug(newpool, abort_fn,
+                                         allocator, "undefined");
+}
+
+#undef apr_pool_create_unmanaged_ex
+APR_DECLARE(apr_status_t) apr_pool_create_unmanaged_ex(apr_pool_t **newpool,
+                                                  apr_abortfunc_t abort_fn,
+                                                  apr_allocator_t *allocator);
+
+APR_DECLARE(apr_status_t) apr_pool_create_unmanaged_ex(apr_pool_t **newpool,
+                                                  apr_abortfunc_t abort_fn,
+                                                  apr_allocator_t *allocator)
+{
+    return apr_pool_create_unmanaged_ex_debug(newpool, abort_fn,
                                          allocator, "undefined");
 }
 



Mime
View raw message