| #define APR_POOL__FILE_LINE__ __FILE__ ":" APR_STRINGIFY(__LINE__) |
the place in the code where the particular function was called
| #define APR_POOL_DEBUG 0 |
Pool debug levels
| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---------------------------------
| | | | | | | | x | General debug code enabled (useful in
combination with --with-efence). | | | | | | | x | | Verbose output on stderr (report
CREATE, CLEAR, DESTROY). | | | | x | | | | | Verbose output on stderr (report
PALLOC, PCALLOC). | | | | | | x | | | Lifetime checking. On each use of a
pool, check its lifetime. If the pool
is out of scope, abort().
In combination with the verbose flag
above, it will output LIFE in such an
event prior to aborting. | | | | | x | | | | Pool owner checking. On each use of a
pool, check if the current thread is the
pools owner. If not, abort(). In
combination with the verbose flag above,
it will output OWNER in such an event
prior to aborting. Use the debug
function apr_pool_owner_set() to switch
a pools ownership.When no debug level was specified, assume general debug mode. If level 0 was specified, debugging is switched off
| #define APR_POOL_DECLARE_ACCESSOR | ( | type | ) |
APR_DECLARE(apr_pool_t *) apr_##type##_pool_get \ (const apr_##type##_t *the##type)
Declaration helper macro to construct apr_foo_pool_get()s.
This standardized macro is used by opaque (APR) data types to return the apr_pool_t that is associated with the data type.
APR_POOL_DECLARE_ACCESSOR() is used in a header file to declare the accessor function. A typical usage and result would be:
APR_POOL_DECLARE_ACCESSOR(file);
becomes:
APR_DECLARE(apr_pool_t *) apr_file_pool_get(apr_file_t *ob);
| #define APR_POOL_IMPLEMENT_ACCESSOR | ( | type | ) |
APR_DECLARE(apr_pool_t *) apr_##type##_pool_get \ (const apr_##type##_t *the##type) \ { return the##type->pool; }
Implementation helper macro to provide apr_foo_pool_get()s.
In the implementation, the APR_POOL_IMPLEMENT_ACCESSOR() is used to actually define the function. It assumes the field is named "pool".
| typedef int(* apr_abortfunc_t)(int retcode) |
A function that is called when allocation fails.
| typedef struct apr_pool_t apr_pool_t |
The fundamental pool type
| void* apr_palloc | ( | apr_pool_t * | p, | |
| apr_size_t | size | |||
| ) |
Allocate a block of memory from a pool
| p | The pool to allocate from
|
| void* apr_palloc_debug | ( | apr_pool_t * | p, | |
| apr_size_t | size, | |||
| const char * | file_line | |||
| ) |
Debug version of apr_palloc
| p | See: apr_palloc
|
| void* apr_pcalloc | ( | apr_pool_t * | p, | |
| apr_size_t | size | |||
| ) |
Allocate a block of memory from a pool and set all of the memory to 0
| p | The pool to allocate from
|
| void* apr_pcalloc_debug | ( | apr_pool_t * | p, | |
| apr_size_t | size, | |||
| const char * | file_line | |||
| ) |
Debug version of apr_pcalloc
| p | See: apr_pcalloc
|
| apr_abortfunc_t apr_pool_abort_get | ( | apr_pool_t * | pool | ) |
Get the abort function associated with the specified pool.
| pool | The pool for retrieving the abort function.
|
| void apr_pool_abort_set | ( | apr_abortfunc_t | abortfunc, | |
| apr_pool_t * | pool | |||
| ) |
Set the function to be called when an allocation failure occurs.
| apr_allocator_t* apr_pool_allocator_get | ( | apr_pool_t * | pool | ) |
Find the pool's allocator
| pool | The pool to get the allocator from. |
| void apr_pool_clear | ( | apr_pool_t * | p | ) |
Clear all memory in the pool and run all the cleanups. This also destroys all subpools.
| p | The pool to clear
|
| void apr_pool_clear_debug | ( | apr_pool_t * | p, | |
| const char * | file_line | |||
| ) |
Debug version of apr_pool_clear.
| p | See: apr_pool_clear.
|
| apr_status_t apr_pool_create | ( | apr_pool_t ** | newpool, | |
| apr_pool_t * | parent | |||
| ) |
Create a new pool.
| newpool | The pool we have just created.
|
| apr_status_t apr_pool_create_core | ( | apr_pool_t ** | newpool | ) |
Create a new pool.
| newpool | The pool we have just created. |
| apr_status_t apr_pool_create_core_ex | ( | apr_pool_t ** | newpool, | |
| apr_abortfunc_t | abort_fn, | |||
| apr_allocator_t * | allocator | |||
| ) |
| 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 | |||
| ) |
| apr_status_t apr_pool_create_ex | ( | apr_pool_t ** | newpool, | |
| apr_pool_t * | parent, | |||
| apr_abortfunc_t | abort_fn, | |||
| apr_allocator_t * | allocator | |||
| ) |
Create a new pool.
| newpool | The pool we have just created.
|
| apr_status_t apr_pool_create_ex_debug | ( | apr_pool_t ** | newpool, | |
| apr_pool_t * | parent, | |||
| apr_abortfunc_t | abort_fn, | |||
| apr_allocator_t * | allocator, | |||
| const char * | file_line | |||
| ) |
Debug version of apr_pool_create_ex.
| newpool |
|
| apr_status_t apr_pool_create_unmanaged_ex | ( | apr_pool_t ** | newpool, | |
| apr_abortfunc_t | abort_fn, | |||
| apr_allocator_t * | allocator | |||
| ) |
Create a new unmanaged pool.
| newpool | The pool we have just created.
|
| 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 | |||
| ) |
Debug version of apr_pool_create_unmanaged_ex.
| newpool |
|
| void apr_pool_destroy | ( | apr_pool_t * | p | ) |
Destroy the pool. This takes similar action as apr_pool_clear() and then frees all the memory.
| p | The pool to destroy
|
| void apr_pool_destroy_debug | ( | apr_pool_t * | p, | |
| const char * | file_line | |||
| ) |
Debug version of apr_pool_destroy.
| p | See: apr_pool_destroy.
|
| apr_status_t apr_pool_initialize | ( | void | ) |
Setup all of the internal structures required to use pools
| int apr_pool_is_ancestor | ( | apr_pool_t * | a, | |
| apr_pool_t * | b | |||
| ) |
Determine if pool a is an ancestor of pool b.
| a | The pool to search
|
| apr_pool_t* apr_pool_parent_get | ( | apr_pool_t * | pool | ) |
Get the parent pool of the specified pool.
| pool | The pool for retrieving the parent pool.
|
| void apr_pool_tag | ( | apr_pool_t * | pool, | |
| const char * | tag | |||
| ) |
Tag a pool (give it a name)
| pool | The pool to tag
|
| void apr_pool_terminate | ( | void | ) |
Tear down all of the internal structures required to use pools
| apr_status_t apr_pool_userdata_get | ( | void ** | data, | |
| const char * | key, | |||
| apr_pool_t * | pool | |||
| ) |
Return the data associated with the current pool.
| data | The user data associated with the pool.
|
| apr_status_t apr_pool_userdata_set | ( | const void * | data, | |
| const char * | key, | |||
| apr_status_t(*)(void *) | cleanup, | |||
| apr_pool_t * | pool | |||
| ) |
Set the data associated with the current pool
| data | The user data associated with the pool.
|
| apr_status_t apr_pool_userdata_setn | ( | const void * | data, | |
| const char * | key, | |||
| apr_status_t(*)(void *) | cleanup, | |||
| apr_pool_t * | pool | |||
| ) |
Set the data associated with the current pool
| data | The user data associated with the pool.
|
1.6.3