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