Patch: Add arena constructor to memory.h

This commit is contained in:
0x221E
2026-01-17 18:19:40 +01:00
parent 38ca8ae719
commit e61af99a0c

View File

@@ -1,7 +1,6 @@
#ifndef MEMORY_H #ifndef MEMORY_H
#define MEMORY_H #define MEMORY_H
#ifndef MEM_ARENA_MAX_CAP #ifndef MEM_ARENA_MAX_CAP
#define MEM_ARENA_MAX_CAP 1024 * 1024 #define MEM_ARENA_MAX_CAP 1024 * 1024
#endif #endif
@@ -20,16 +19,20 @@ struct Backend
size_t cap; size_t cap;
}; };
#define BACKEND_CONST {NULL, NULL, 0, 0}
struct Arena struct Arena
{ {
void* mem; void* mem;
void* last; void* last;
size_t len; size_t len;
size_t cap; size_t cap;
void* next; void* next; //TODO
struct Backend* b; struct Backend* b;
}; };
#define ARENA_CONST {NULL, NULL, 0, 0, NULL}
typedef struct Backend Backend; typedef struct Backend Backend;
typedef struct Arena Arena; typedef struct Arena Arena;