apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r761692 - /apr/apr/trunk/memory/unix/apr_pools.c
Date Fri, 03 Apr 2009 14:31:17 GMT
Author: mturk
Date: Fri Apr  3 14:31:16 2009
New Revision: 761692

URL: http://svn.apache.org/viewvc?rev=761692&view=rev
Log:
Make final_block dynamic.
It is used only so we can create our mutex that will survive pool_clear

Modified:
    apr/apr/trunk/memory/unix/apr_pools.c

Modified: apr/apr/trunk/memory/unix/apr_pools.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/memory/unix/apr_pools.c?rev=761692&r1=761691&r2=761692&view=diff
==============================================================================
--- apr/apr/trunk/memory/unix/apr_pools.c (original)
+++ apr/apr/trunk/memory/unix/apr_pools.c Fri Apr  3 14:31:16 2009
@@ -486,8 +486,8 @@
     apr_abortfunc_t       abort_fn;
     apr_hash_t           *user_data;
     const char           *tag;
-    block_list_t         first_block, final_block;
-    
+    block_list_t         first_block;
+    block_list_t        *final_block;    
     block_list_t        *blocks;
 
 #if APR_HAS_THREADS
@@ -789,7 +789,10 @@
 
     block_list_destroy_all(pool->blocks);
     run_cleanups(&pool->final_cleanups);
-    block_list_destroy(&pool->final_block);
+    if (pool->final_block) {
+        block_list_destroy(pool->final_block);
+        free(pool->final_block);
+    }
     free(pool);
 }
 
@@ -820,28 +823,28 @@
     pool->subprocesses = NULL;
     pool->user_data = NULL;
     pool->tag = NULL;
+    pool->cleanups = NULL;
+    pool->final_block = NULL;
+    pool->final_cleanups = NULL;
 
     if (allocator) {
-        pool->blocks = &pool->final_block;
+        pool->blocks = malloc(sizeof(block_list_t));
         pool->blocks->offset = 0;
         pool->blocks->next = NULL;
         pool->blocks->size = BLOCK_LIST_ENTRIES_MIN;
-        pool->cleanups = NULL;
         (void)apr_thread_mutex_create(&pool->mutex,
                                       APR_THREAD_MUTEX_NESTED, pool);
         pool->final_cleanups = pool->cleanups;
+        pool->final_block = pool->blocks;
+        pool->cleanups = NULL;
     }
     else {
-        pool->final_cleanups = NULL;
-        pool->final_block.offset = 0;
-        pool->final_block.next = NULL;
         pool->mutex = parent->mutex;
     }
     pool->blocks = &pool->first_block;
     pool->blocks->offset = 0;
     pool->blocks->next = NULL;
     pool->blocks->size = BLOCK_LIST_ENTRIES_MIN;
-    pool->cleanups = NULL;
     
     
 #ifdef NETWARE



Mime
View raw message