aboutsummaryrefslogtreecommitdiff
path: root/CRT/kcrt.cpp
blob: 32681ab83cea3a243dbd7a0c19850470a8fab36b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
 * Shameless copy pasta from: https://github.com/sidyhe/dxx
 * and: https://github.com/liupengs/Mini-CRT
 * and some minor modifications.
 */

#include <cstdio>
#include <cstdlib>

// new & delete

void * __cdecl operator new(std::size_t size)
{
    return malloc(size);
}

void * __cdecl operator new[](size_t size)
{
    return malloc(size);
}

void __cdecl operator delete(void * ptr)
{
    free(ptr);
}

void __cdecl operator delete(void * ptr, size_t)
{
    free(ptr);
}

void __cdecl operator delete[](void * ptr, long long unsigned int)
{
    free(ptr);
}

void __cdecl operator delete[](void * ptr)
{
    free(ptr);
}

// EASTL

void * operator new[](size_t size, const char *, int, unsigned, const char *, int)
{
    return malloc(size);
}
void * operator new[](size_t size, size_t, size_t, const char *, int, unsigned, const char *, int)
{
    return malloc(size);
}