wrap free() for use w/ dmalloc

This commit is contained in:
Doug MacEachern 2005-11-09 19:31:02 +00:00
parent 78d620897b
commit 4f19d45af9
1 changed files with 7 additions and 1 deletions

View File

@ -13,6 +13,12 @@
#define ENTRIES_SIZE(n) \ #define ENTRIES_SIZE(n) \
(sizeof(sigar_cache_entry_t *) * (n)) (sizeof(sigar_cache_entry_t *) * (n))
/* wrap free() for use w/ dmalloc */
static void free_value(void *ptr)
{
free(ptr);
}
sigar_cache_t *sigar_cache_new(int size) sigar_cache_t *sigar_cache_new(int size)
{ {
sigar_cache_t *table = malloc(sizeof(*table)); sigar_cache_t *table = malloc(sizeof(*table));
@ -20,7 +26,7 @@ sigar_cache_t *sigar_cache_new(int size)
table->size = size; table->size = size;
table->entries = malloc(ENTRIES_SIZE(size)); table->entries = malloc(ENTRIES_SIZE(size));
memset(table->entries, '\0', ENTRIES_SIZE(size)); memset(table->entries, '\0', ENTRIES_SIZE(size));
table->free_value = free; table->free_value = free_value;
return table; return table;
} }