diff options
author | gstein <gstein@13f79535-47bb-0310-9956-ffa450edef68> | 2001-04-26 21:29:00 +0000 |
---|---|---|
committer | gstein <gstein@13f79535-47bb-0310-9956-ffa450edef68> | 2001-04-26 21:29:00 +0000 |
commit | ea1485ed00f94de5e84cdc753861757b43748485 (patch) | |
tree | a2fd9832331d859d5ae6dc55e9f2155f529f4bcf /include | |
parent | 418345dde93fea90728a3f35cc728fb962fb1d32 (diff) | |
download | libapr-ea1485ed00f94de5e84cdc753861757b43748485.tar.gz |
*) Make the apr_pool_t structure private.
*) rename apr_set_abort (in apr_general.h) to apr_pool_set_abort (in
apr_pools.h)
*) add apr_pool_get_abort (used in apr-util/xml/apr_xml.c)
*) add apr_abortfunc_t type and use throughout
*) some simplifications within apr_pools.c
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@61551 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'include')
-rw-r--r-- | include/apr_general.h | 13 | ||||
-rw-r--r-- | include/apr_pools.h | 56 |
2 files changed, 21 insertions, 48 deletions
diff --git a/include/apr_general.h b/include/apr_general.h index f49ba6c0c..4d62d42d8 100644 --- a/include/apr_general.h +++ b/include/apr_general.h @@ -174,19 +174,6 @@ APR_DECLARE(apr_status_t) apr_initialize(void); */ APR_DECLARE(void) apr_terminate(void); -/** - * Set the APR_ABORT function. - * @tip This is in for backwards compatability. If the program using - * APR wants APR to exit on a memory allocation error, then this - * function should be called to set the function to use in order - * to actually exit the program. If this function is not called, - * then APR will return an error and expect the calling program to - * deal with the error accordingly. - * @deffunc apr_status_t apr_set_abort(int (*apr_abort)(int retcode), apr_pool_t *cont) - */ -APR_DECLARE(apr_status_t) apr_set_abort(int (*apr_abort)(int retcode), - apr_pool_t *cont); - #ifdef __cplusplus } #endif diff --git a/include/apr_pools.h b/include/apr_pools.h index 9419c0e90..10449e7cb 100644 --- a/include/apr_pools.h +++ b/include/apr_pools.h @@ -89,46 +89,13 @@ extern "C" { /* #define APR_POOL_DEBUG -#define ALLOC_USE_MALLOC */ /** The fundamental pool type */ typedef struct apr_pool_t apr_pool_t; -/** The memory allocation structure - */ -struct apr_pool_t { - /** The first block in this pool. */ - union block_hdr *first; - /** The last block in this pool. */ - union block_hdr *last; - /** The list of cleanups to run on pool cleanup. */ - struct cleanup *cleanups; - /** A list of processes to kill when this pool is cleared */ - struct process_chain *subprocesses; - /** The first sub_pool of this pool */ - struct apr_pool_t *sub_pools; - /** The next sibling pool */ - struct apr_pool_t *sub_next; - /** The previous sibling pool */ - struct apr_pool_t *sub_prev; - /** The parent pool of this pool */ - struct apr_pool_t *parent; - /** The first free byte in this pool */ - char *free_first_avail; -#ifdef ALLOC_USE_MALLOC - /** The allocation list if using malloc */ - void *allocation_list; -#endif -#ifdef APR_POOL_DEBUG - /** a list of joined pools */ - struct apr_pool_t *joined; -#endif - /** A function to control how pools behave when they receive ENOMEM */ - int (*apr_abort)(int retcode); - /** A place to hold user data associated with this pool */ - struct apr_hash_t *prog_data; -}; +/** A function that is called when allocation fails. */ +typedef int (*apr_abortfunc_t)(int retcode); /* pools have nested lifetimes -- sub_pools are destroyed when the * parent pool is cleared. We allow certain liberties with operations @@ -226,6 +193,25 @@ APR_DECLARE(apr_status_t) apr_pool_create(apr_pool_t **newcont, apr_pool_t *cont); /** + * Set the function to be called when an allocation failure occurs. + * @tip If the program wants APR to exit on a memory allocation error, + * then this function can be called to set the callback to use (for + * performing cleanup and then exiting). If this function is not called, + * then APR will return an error and expect the calling program to + * deal with the error accordingly. + * @deffunc apr_status_t apr_pool_set_abort(apr_abortfunc_t abortfunc, apr_pool_t *pool) + */ +APR_DECLARE(void) apr_pool_set_abort(apr_abortfunc_t abortfunc, + apr_pool_t *pool); + +/** + * Get the abort function associated with the specified pool. + * @param pool The pool for retrieving the abort function. + * @deffunc apr_abortfunc_t apr_pool_get_abort(apr_pool_t *pool) + */ +APR_DECLARE(apr_abortfunc_t) apr_pool_get_abort(apr_pool_t *pool); + +/** * Set the data associated with the current pool * @param data The user data associated with the pool. * @param key The key to use for association |