blob: 076261d2fc1b00d950a40205832bb371615faa56 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
#pragma once
#include <stdlib.h>
#define malloc(num, type) \
((type*)check_after_allocation("malloc", malloc((num)*sizeof(type))))
#define calloc(num, type) \
((type*)check_after_allocation("calloc", calloc((num), sizeof(type))))
#define realloc(ptr, num, type) \
((type*)check_after_allocation("realloc", realloc(ptr, (num)*sizeof(type))))
void* check_after_allocation(const char *funcname, void *ptr);
|