striker 2002/11/19 12:00:26
Modified: memory/unix apr_pools.c
Log:
Fix cleanups so cleanups actually get run when registered from within another
cleanup.
Revision Changes Path
1.191 +16 -11 apr/memory/unix/apr_pools.c
Index: apr_pools.c
===================================================================
RCS file: /home/cvs/apr/memory/unix/apr_pools.c,v
retrieving revision 1.190
retrieving revision 1.191
diff -u -r1.190 -r1.191
--- apr_pools.c 12 Nov 2002 21:22:53 -0000 1.190
+++ apr_pools.c 19 Nov 2002 20:00:26 -0000 1.191
@@ -523,8 +523,8 @@
* Local functions
*/
-static void run_cleanups(cleanup_t *c);
-static void run_child_cleanups(cleanup_t *c);
+static void run_cleanups(cleanup_t **c);
+static void run_child_cleanups(cleanup_t **c);
static void free_proc_chain(struct process_chain *procs);
@@ -715,7 +715,7 @@
apr_pool_destroy(pool->child);
/* Run cleanups */
- run_cleanups(pool->cleanups);
+ run_cleanups(&pool->cleanups);
pool->cleanups = NULL;
/* Free subprocesses */
@@ -752,7 +752,7 @@
apr_pool_destroy(pool->child);
/* Run cleanups */
- run_cleanups(pool->cleanups);
+ run_cleanups(&pool->cleanups);
/* Free subprocesses */
free_proc_chain(pool->subprocesses);
@@ -1389,7 +1389,7 @@
apr_pool_destroy_debug(pool->child, file_line);
/* Run cleanups */
- run_cleanups(pool->cleanups);
+ run_cleanups(&pool->cleanups);
pool->cleanups = NULL;
/* Free subprocesses */
@@ -1967,26 +1967,31 @@
return (*cleanup_fn)(data);
}
-static void run_cleanups(cleanup_t *c)
+static void run_cleanups(cleanup_t **cref)
{
+ cleanup_t *c = *cref;
+
while (c) {
+ *cref = c->next;
(*c->plain_cleanup_fn)((void *)c->data);
- c = c->next;
+ c = *cref;
}
}
-static void run_child_cleanups(cleanup_t *c)
+static void run_child_cleanups(cleanup_t **cref)
{
+ cleanup_t *c = *cref;
+
while (c) {
+ *cref = c->next;
(*c->child_cleanup_fn)((void *)c->data);
- c = c->next;
+ c = *cref;
}
}
static void cleanup_pool_for_exec(apr_pool_t *p)
{
- run_child_cleanups(p->cleanups);
- p->cleanups = NULL;
+ run_child_cleanups(&p->cleanups);
for (p = p->child; p; p = p->sibling)
cleanup_pool_for_exec(p);