00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
#ifndef APR_ALLOCATOR_H
00017
#define APR_ALLOCATOR_H
00018
00024
#include "apr.h"
00025
#include "apr_errno.h"
00026 #define APR_WANT_MEMFUNC
00027
#include "apr_want.h"
00028
00029
#ifdef __cplusplus
00030
extern "C" {
00031
#endif
00032
00040 typedef struct apr_allocator_t apr_allocator_t;
00042 typedef struct apr_memnode_t apr_memnode_t;
00043
00045 struct apr_memnode_t {
00046 apr_memnode_t *
next;
00047 apr_memnode_t **
ref;
00048 apr_uint32_t
index;
00049 apr_uint32_t
free_index;
00050 char *
first_avail;
00051 char *
endp;
00052 };
00053
00055 #define APR_MEMNODE_T_SIZE APR_ALIGN_DEFAULT(sizeof(apr_memnode_t))
00056
00058 #define APR_ALLOCATOR_MAX_FREE_UNLIMITED 0
00059
00065
APR_DECLARE(apr_status_t) apr_allocator_create(apr_allocator_t **allocator);
00066
00073 APR_DECLARE(
void) apr_allocator_destroy(apr_allocator_t *allocator);
00074
00081 APR_DECLARE(apr_memnode_t *) apr_allocator_alloc(apr_allocator_t *allocator,
00082 apr_size_t size);
00083
00089 APR_DECLARE(
void) apr_allocator_free(apr_allocator_t *allocator,
00090 apr_memnode_t *memnode);
00091
00092 #include "apr_pools.h"
00093
00100
00101
00102
00103
00104
00105 APR_DECLARE(
void) apr_allocator_owner_set(apr_allocator_t *allocator,
00106 apr_pool_t *pool);
00107
00109 APR_DECLARE(
void) apr_allocator_set_owner(apr_allocator_t *allocator,
00110 apr_pool_t *pool);
00111
00116 APR_DECLARE(apr_pool_t *) apr_allocator_owner_get(apr_allocator_t *allocator);
00117
00119 APR_DECLARE(apr_pool_t *) apr_allocator_get_owner(
00120 apr_allocator_t *allocator);
00121
00128 APR_DECLARE(
void) apr_allocator_max_free_set(apr_allocator_t *allocator,
00129 apr_size_t size);
00130
00132 APR_DECLARE(
void) apr_allocator_set_max_free(apr_allocator_t *allocator,
00133 apr_size_t size);
00134
00135 #include "apr_thread_mutex.h"
00136
00137 #if APR_HAS_THREADS
00143 APR_DECLARE(
void) apr_allocator_mutex_set(apr_allocator_t *allocator,
00144
apr_thread_mutex_t *mutex);
00145
00147 APR_DECLARE(
void) apr_allocator_set_mutex(apr_allocator_t *allocator,
00148 apr_thread_mutex_t *mutex);
00149
00154 APR_DECLARE(apr_thread_mutex_t *) apr_allocator_mutex_get(
00155 apr_allocator_t *allocator);
00156
00158 APR_DECLARE(apr_thread_mutex_t *) apr_allocator_get_mutex(
00159 apr_allocator_t *allocator);
00160
00161 #endif
00162
00165 #ifdef __cplusplus
00166 }
00167 #endif
00168
00169 #endif