You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by mt...@apache.org on 2008/04/12 15:37:38 UTC
svn commit: r647447 - /apr/apr/trunk/memory/unix/apr_pools.c
Author: mturk
Date: Sat Apr 12 06:37:37 2008
New Revision: 647447
URL: http://svn.apache.org/viewvc?rev=647447&view=rev
Log:
Add apr_pool_pre_cleanup_register implementation.
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=647447&r1=647446&r2=647447&view=diff
==============================================================================
--- apr/apr/trunk/memory/unix/apr_pools.c (original)
+++ apr/apr/trunk/memory/unix/apr_pools.c Sat Apr 12 06:37:37 2008
@@ -2224,6 +2224,30 @@
}
}
+APR_DECLARE(void) apr_pool_pre_cleanup_register(apr_pool_t *p, const void *data,
+ apr_status_t (*plain_cleanup_fn)(void *data))
+{
+ cleanup_t *c;
+
+#if APR_POOL_DEBUG
+ apr_pool_check_integrity(p);
+#endif /* APR_POOL_DEBUG */
+
+ if (p != NULL) {
+ if (p->free_pre_cleanups) {
+ /* reuse a cleanup structure */
+ c = p->free_pre_cleanups;
+ p->free_pre_cleanups = c->next;
+ } else {
+ c = apr_palloc(p, sizeof(cleanup_t));
+ }
+ c->data = data;
+ c->plain_cleanup_fn = plain_cleanup_fn;
+ c->next = p->cleanups;
+ p->cleanups = c;
+ }
+}
+
APR_DECLARE(void) apr_pool_cleanup_kill(apr_pool_t *p, const void *data,
apr_status_t (*cleanup_fn)(void *))
{