/work/toxcore/mem_test_util.cc
Line | Count | Source |
1 | | #include "mem_test_util.hh" |
2 | | |
3 | | #include <cstdlib> |
4 | | |
5 | | #include "test_util.hh" |
6 | | #include "tox_memory_impl.h" |
7 | | |
8 | | Tox_Memory_Funcs const Memory_Class::vtable = { |
9 | | Method<tox_memory_malloc_cb, Memory_Class>::invoke<&Memory_Class::malloc>, |
10 | | Method<tox_memory_realloc_cb, Memory_Class>::invoke<&Memory_Class::realloc>, |
11 | | Method<tox_memory_dealloc_cb, Memory_Class>::invoke<&Memory_Class::dealloc>, |
12 | | }; |
13 | | |
14 | 860 | Memory_Class::~Memory_Class() = default; |
15 | | |
16 | | void *Test_Memory::malloc(void *obj, uint32_t size) |
17 | 5.37k | { |
18 | 5.37k | return mem->funcs->malloc_callback(mem->user_data, size); |
19 | 5.37k | } |
20 | | |
21 | | void *Test_Memory::realloc(void *obj, void *ptr, uint32_t size) |
22 | 18 | { |
23 | 18 | return mem->funcs->realloc_callback(mem->user_data, ptr, size); |
24 | 18 | } |
25 | | |
26 | | void Test_Memory::dealloc(void *obj, void *ptr) |
27 | 5.39k | { |
28 | 5.39k | return mem->funcs->dealloc_callback(mem->user_data, ptr); |
29 | 5.39k | } |