/* IRCfs - IRC FileServ for *nix. * Copyright (C) 2002 Nick 'Zaf' Clifford * For licensing details, refer to the LICENSE file in the source * code directory. */ #ifndef __include_pool_h__ #define __include_pool_h__ #define POOL_MAGIC 0xAB1287AA #define DEFAULT_POOL_SIZE 1024 #define POOL_TMP_SIZE 1024 #include #include #include #include #include struct pool; typedef struct pool * POOL; struct pool *pool_new_n(struct pool *parent, size_t size); #define pool_new(p) (pool_new_n(p,DEFAULT_POOL_SIZE)) void pool_destroy(POOL p); void *palloc(POOL p, size_t size); char *pstrdup(POOL p, const char *str); char *pstrdupn(POOL p, const char *str, size_t n); void *tmp_alloc(size_t size); char *tmp_strdup(const char *str); char *tmp_strdupn(const char *str, size_t n); #ifdef POOL_MAINTAINANCE POOL pool_new_n_debug(POOL parent, size_t size, const char *file, int line); void *palloc_debug(POOL p, size_t size, const char *file, int line); #define palloc(p,size) palloc_debug(p,size,__FILE__,__LINE__) #define pool_new_n(p,size) new_pool_n_debug(p,size,__FILE__,__LINE__) #define pool_new(p) new_pool_n_debug(p,DEFAULT_POOl_SIZE,__FILE__,__LINE__) #endif #endif