version 1.1.2.1, 2012/05/23 10:54:45
|
version 1.1.2.3, 2012/05/23 13:53:00
|
Line 7
|
Line 7
|
#define MEM_BUCKETS 28 /* 32 bits - 4 bits = 28 items in bucket array */ |
#define MEM_BUCKETS 28 /* 32 bits - 4 bits = 28 items in bucket array */ |
|
|
struct tagAlloc { |
struct tagAlloc { |
char alloc_name[MAX_ATTRIBUTE]; | char alloc_name[64]; |
|
|
unsigned int *alloc_mem; |
unsigned int *alloc_mem; |
|
|
Line 106 int mpool_free2(mpool_t * __restrict mp, unsigned int
|
Line 106 int mpool_free2(mpool_t * __restrict mp, unsigned int
|
void *mpool_realloc(mpool_t * __restrict mp, void * __restrict data, |
void *mpool_realloc(mpool_t * __restrict mp, void * __restrict data, |
unsigned int newsize, const char *memname); |
unsigned int newsize, const char *memname); |
/* |
/* |
|
* mpool_strdup() - String duplicate |
|
* |
|
* @mp = Memory pool |
|
* @str = String |
|
* @memname = Memory name |
|
* return: NULL error or !=NULL new string |
|
*/ |
|
char *mpool_strdup(mpool_t * __restrict mp, const char *str, const char *memname); |
|
/* |
* mpool_getmembynam() Find allocated memory block by size and memory name |
* mpool_getmembynam() Find allocated memory block by size and memory name |
* |
* |
* @mp = Memory pool |
* @mp = Memory pool |
Line 154 inline void mpool_getquota(mpool_t * __restrict mp, un
|
Line 163 inline void mpool_getquota(mpool_t * __restrict mp, un
|
* return: none |
* return: none |
*/ |
*/ |
void mpool_statistics(mpool_t * __restrict mp, mpool_stat_cb cb); |
void mpool_statistics(mpool_t * __restrict mp, mpool_stat_cb cb); |
|
|
|
|
|
/* Wrappers */ |
|
|
|
/* |
|
* mpool_xmalloc() - malloc wrapper |
|
* |
|
* @size = Size |
|
* return: NULL error or !=NULL ok allocated memory |
|
*/ |
|
void *mpool_xmalloc(size_t size); |
|
/* |
|
* mpool_xcalloc() - calloc wrapper |
|
* |
|
* @num = number of elements |
|
* @size = Size of element |
|
* return: NULL error or !=NULL ok allocated memory |
|
*/ |
|
void *mpool_xcalloc(size_t num, size_t size); |
|
/* |
|
* mpool_xrealloc() - realloc wrapper |
|
* |
|
* @data = Allocated memory data |
|
* @newsize = New size of memory block |
|
* return: NULL error or !=NULL new reallocated memory block |
|
*/ |
|
void *mpool_xrealloc(void * __restrict data, size_t newsize); |
|
/* |
|
* mpool_xfree() - free wrapper |
|
* |
|
* @data = Allocated memory data |
|
* return: none |
|
*/ |
|
void mpool_xfree(void * __restrict data); |
|
/* |
|
* mpool_xstrdup() - strdup wrapper |
|
* |
|
* @str = string |
|
* return: =NULL error or !=NULL new allocated string |
|
*/ |
|
char *mpool_xstrdup(const char *str); |
|
|
|
|
#endif |
#endif |