blob: 6fcb7e13f46a24f16a2423272d71efa3d9ac343e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#pragma once
#include <stdlib.h>
#include <string.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))))
#define strdup(str) \
((char*)check_after_allocation("strdup", strdup(str)))
void* check_after_allocation(const char *funcname, void *ptr);
|