1 /* 2 * aprsc 3 * 4 * (c) Matti Aarnio, OH2MQK, <oh2mqk@sral.fi> 5 * 6 * This program is licensed under the BSD license, which can be found 7 * in the file LICENSE. 8 * 9 */ 10 11 #ifndef _FOR_VALGRIND_ /* This does not mix with valgrind... */ 12 #ifndef _CELLMALLOC_H_ 13 #define _CELLMALLOC_H_ 14 15 /* 16 * cellmalloc() -- manages arrays of cells of data 17 * 18 */ 19 20 struct cellstatus_t { 21 int cellsize; 22 int alignment; 23 int cellsize_aligned; 24 int cellcount; 25 int freecount; 26 int blocks; 27 int blocks_max; 28 int block_size; 29 }; 30 31 typedef struct cellarena_t cellarena_t; 32 33 extern cellarena_t *cellinit(const char *arenaname, const int cellsize, const int alignment, const int policy, const int createkb, const int minfree); 34 35 #define CELLMALLOC_POLICY_FIFO 0 36 #define CELLMALLOC_POLICY_LIFO 1 37 #define CELLMALLOC_POLICY_NOMUTEX 2 38 39 extern void *cellmalloc(cellarena_t *cellarena); 40 extern int cellmallocmany(cellarena_t *cellarena, void **array, const int numcells); 41 extern void cellfree(cellarena_t *cellarena, void *p); 42 extern void cellfreemany(cellarena_t *cellarena, void **array, const int numcells); 43 extern void cellstatus(cellarena_t *cellarena, struct cellstatus_t *status); 44 45 #endif 46 #else /* _FOR_VALGRIND_ .. normal malloc/free is better */ 47 48 #include "hmalloc.h" 49 50 #endif 51