blob: 3f1461b7b382ac0ee08f38d52d3ee69a3cd682c6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#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();
/* Helper functions */
char* M_strdup(MemoryManager mm, const char* str);
#endif /* _MEMORY_MANAGER */
|