mempool.h revision b53ec8a932a4ea4b983d0e4318ef0ea505c5f9b0
#ifndef __MEMPOOL_H
#define __MEMPOOL_H
#include "macros.h"
/* #define POOL_CHECK_LEAKS */
/* Memory allocated and reallocated (the new data in it) in pools is always
zeroed, it will cost only a few CPU cycles and may well save some debug
time. */
struct Pool {
/* reallocate the `mem' to be exactly `size' */
/* reallocate the `mem' to be at least `size' if it wasn't previously */
/* Frees all the memory in pool. NOTE: system_pool doesn't support
this and crashes if it's used */
};
/* system_pool uses calloc() + realloc() + free() */
extern Pool system_pool;
/* memory allocated from data_stack is valid only until next t_pop() call. */
extern Pool data_stack_pool;
/* If allocfree is FALSE, p_free() has no effect. Note that `size' specifies
the initial malloc()ed block size, part of it is used internally. */
/* Pools should be used through these macros: */
/* Extra macros to make life easier: */
STMT_START { \
} STMT_END
/* p_free_clean() should be used when pool is being destroyed, so freeing
memory isn't needed for anything else than detecting memory leaks. */
#ifdef POOL_CHECK_LEAKS
#else
#endif
#endif