23 #ifndef INCL_UTIL_POOL_H
24 #define INCL_UTIL_POOL_H 1
33 # ifdef JABBERD2_EXPORTS
34 # define JABBERD2_API __declspec(dllexport)
36 # define JABBERD2_API __declspec(dllimport)
39 # define JABBERD2_API extern
45 #define POOL_NUM 40009
87 char name[8], zone[32];
93 # define pool_new() _pool_new(__FILE__,__LINE__)
94 # define pool_heap(i) _pool_new_heap(i,__FILE__,__LINE__)
96 # define pool_heap(i) _pool_new_heap(i,NULL,0)
97 # define pool_new() _pool_new(NULL,0)
JABBERD2_API pool_t _pool_new(const char *file, int line)
make an empty pool
pfree - a linked list node which stores an allocation chunk, plus a callback
struct pool_struct _pool
pool - base node for a pool.
JABBERD2_API void pool_stat(int full)
JABBERD2_API char * pstrdupx(pool_t p, const char *src, int len)
use given size
JABBERD2_API char * pstrdup(pool_t p, const char *src)
XXX efficient: move this to const char * and then loop throug the existing heaps to see if src is wit...
struct pool_struct * pool_t
struct pfree * cleanup_tail
JABBERD2_API void pool_free(pool_t p)
JABBERD2_API void * pmalloc(pool_t, int size)
pheap - singular allocation of memory
pool - base node for a pool.
JABBERD2_API pool_t _pool_new_heap(int size, const char *file, int line)
JABBERD2_API void pool_cleanup(pool_t p, pool_cleanup_t fn, void *arg)
public cleanup utils, insert in a way that they are run FIFO, before mem frees
void(* pool_cleanup_t)(void *arg)
pool_cleanup_t - callback type which is associated with a pool entry; invoked when the pool entry is ...
JABBERD2_API int pool_size(pool_t p)
JABBERD2_API void * pmalloc_x(pool_t p, int size, char c)
JABBERD2_API void * pmalloco(pool_t p, int size)
easy safety utility (for creating blank mem for structs, etc)