/work/toxcore/mem_test_util.cc
Line | Count | Source |
1 | | #include "mem_test_util.hh" |
2 | | |
3 | | #include <cstdlib> |
4 | | |
5 | | Memory_Funcs const Memory_Class::vtable = { |
6 | | Method<mem_malloc_cb, Memory_Class>::invoke<&Memory_Class::malloc>, |
7 | | Method<mem_calloc_cb, Memory_Class>::invoke<&Memory_Class::calloc>, |
8 | | Method<mem_realloc_cb, Memory_Class>::invoke<&Memory_Class::realloc>, |
9 | | Method<mem_free_cb, Memory_Class>::invoke<&Memory_Class::free>, |
10 | | }; |
11 | | |
12 | 651 | Memory_Class::~Memory_Class() = default; |
13 | | |
14 | 9 | void *Test_Memory::malloc(void *obj, uint32_t size) { return mem->funcs->malloc(mem->obj, size); } |
15 | | |
16 | | void *Test_Memory::calloc(void *obj, uint32_t nmemb, uint32_t size) |
17 | 471 | { |
18 | 471 | return mem->funcs->calloc(mem->obj, nmemb, size); |
19 | 471 | } |
20 | | |
21 | | void *Test_Memory::realloc(void *obj, void *ptr, uint32_t size) |
22 | 2 | { |
23 | 2 | return mem->funcs->realloc(mem->obj, ptr, size); |
24 | 2 | } |
25 | | |
26 | 586 | void Test_Memory::free(void *obj, void *ptr) { return mem->funcs->free(mem->obj, ptr); } |