00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef AXIS2_ALLOCATOR_H
00018 #define AXIS2_ALLOCATOR_H
00019
00025 #include <axis2_utils_defines.h>
00026
00027 #ifdef __cplusplus
00028 extern "C"
00029 {
00030 #endif
00031
00046 typedef struct axis2_allocator
00047 {
00048
00049
00058 void * (AXIS2_CALL *malloc_fn) (struct axis2_allocator *allocator, size_t size);
00068 void * (AXIS2_CALL *realloc) (struct axis2_allocator *allocator, void *ptr, size_t size);
00076 void (AXIS2_CALL *free_fn) (struct axis2_allocator *allocator, void *ptr);
00077 } axis2_allocator_t;
00078
00084 AXIS2_EXTERN axis2_allocator_t * AXIS2_CALL
00085 axis2_allocator_init (axis2_allocator_t *allocator);
00086
00092 AXIS2_EXTERN axis2_status_t AXIS2_CALL
00093 axis2_allocator_free(axis2_allocator_t *allocator);
00094
00095 #define AXIS2_MALLOC(allocator, size) \
00096 ((allocator)->malloc_fn(allocator, size))
00097
00098 #define AXIS2_REALLOC(allocator, ptr, size) \
00099 ((allocator)->realloc(allocator, ptr, size))
00100
00101 #define AXIS2_FREE(allocator, ptr) \
00102 ((allocator)->free_fn(allocator, ptr))
00103
00106 #ifdef __cplusplus
00107 }
00108 #endif
00109
00110 #endif