Implemented memory management

This commit is contained in:
2020-11-03 16:42:53 +01:00
parent bc6c2bd0c1
commit fba1b6487f
4 changed files with 107 additions and 2 deletions

18
src/magic_memory.h Normal file
View File

@@ -0,0 +1,18 @@
//
// Created by marcsello on 03/11/2020.
//
#ifndef CAFF_PREVIEWER_MAGIC_MEMORY_H
#define CAFF_PREVIEWER_MAGIC_MEMORY_H
typedef struct magic_memory_t {
void* next;
void *ptr;
} magic_memory_t;
magic_memory_t* magic_memory_begin(void);
void* magic_malloc(magic_memory_t* magic_memory, size_t size);
void magic_free(magic_memory_t* magic_memory, void* ptr);
void magic_cleanup(magic_memory_t* magic_memory);
#endif //CAFF_PREVIEWER_MAGIC_MEMORY_H