--- libaitio/inc/Attic/ampool.h 2012/05/23 10:54:45 1.1.2.1 +++ libaitio/inc/Attic/ampool.h 2012/05/23 13:53:00 1.1.2.3 @@ -7,7 +7,7 @@ #define MEM_BUCKETS 28 /* 32 bits - 4 bits = 28 items in bucket array */ struct tagAlloc { - char alloc_name[MAX_ATTRIBUTE]; + char alloc_name[64]; unsigned int *alloc_mem; @@ -106,6 +106,15 @@ int mpool_free2(mpool_t * __restrict mp, unsigned int void *mpool_realloc(mpool_t * __restrict mp, void * __restrict data, 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 * * @mp = Memory pool @@ -154,6 +163,47 @@ inline void mpool_getquota(mpool_t * __restrict mp, un * return: none */ 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