summaryrefslogtreecommitdiff
path: root/wrap.c
blob: 5ed0bc8359b54e87997808fc9058a21feb6f9407 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <stddef.h>

#include "wrap.h"

void *(*_REAL(malloc))(size_t size) = NULL;
void (*_REAL(free))(void *ptr) = NULL;
void *(*_REAL(calloc))(size_t nmemb, size_t size) = NULL;
void *(*_REAL(realloc))(void *ptr, size_t size) = NULL;

#ifdef __GNUC__
void __attribute__((constructor)) __wrap_init()
{
    // set the real values up as soon as possible
    REAL(malloc);
    REAL(free);
    REAL(calloc);
    REAL(realloc);
}
#endif