blob: 1025e69cb8ff0c32eaabbb6ba484ae6024ae7baf (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#ifndef _MEMORY_MANAGER
#define _MEMORY_MANAGER
#include "Types.h"
typedef struct MemoryManager {
Result (* const alloc)(struct MemoryManager mm, void **ptr, usize size);
Result (* const realloc)(struct MemoryManager mm, void **ptr, usize new_size);
Result (* const free)(struct MemoryManager mm, void **ptr);
Result (* const destroy)(struct MemoryManager *mm);
void *priv;
} MemoryManager;
MemoryManager M_std();
MemoryManager M_std_tracked();
/* Helper functions */
char* M_strdup(MemoryManager mm, const char* str);
#endif /* _MEMORY_MANAGER */
|