Add debug_calloc() to the debug_heap.
This commit is contained in:
parent
d58aadcdca
commit
fcc4ecb0c7
@ -19,6 +19,7 @@ extern "C" {
|
||||
debug_alloc_pool* create_debug_alloc_pool();
|
||||
void delete_debug_alloc_pool(debug_alloc_pool* pool);
|
||||
void* debug_malloc(size_t size);
|
||||
void* debug_calloc(size_t num, size_t size);
|
||||
void debug_free(void* address);
|
||||
void debug_heap_init();
|
||||
|
||||
|
@ -278,6 +278,19 @@ debug_malloc(size_t size)
|
||||
}
|
||||
|
||||
|
||||
void*
|
||||
debug_calloc(size_t num, size_t size)
|
||||
{
|
||||
size_t allocationSize = num * size;
|
||||
void* allocation = debug_malloc(allocationSize);
|
||||
if (allocation == NULL)
|
||||
return NULL;
|
||||
|
||||
memset(allocation, 0, allocationSize);
|
||||
return allocation;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
debug_free(void* address)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user