diff options
author | Joshua Rowe <17525998+omnisci3nce@users.noreply.github.com> | 2024-06-09 14:59:01 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-09 14:59:01 +1000 |
commit | 9c79df522980eabdc5e52592cbd152e2a285c4cc (patch) | |
tree | 9082af194033e5e3e4a770456209d3bac7784943 /src/std/mem.c | |
parent | 8d116bd23d9441e33cb3377e90c08169109b438a (diff) | |
parent | d4ff15d9cd82a6e3bc71da9d04ee0f250460cef1 (diff) |
Merge pull request #16 from omnisci3nce/port-opengl-ral
Bring back OpenGL (part 1)
Diffstat (limited to 'src/std/mem.c')
-rw-r--r-- | src/std/mem.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/std/mem.c b/src/std/mem.c index a5321fb..ede1db4 100644 --- a/src/std/mem.c +++ b/src/std/mem.c @@ -46,15 +46,18 @@ void arena_rewind(arena_save savepoint) { savepoint.arena->curr = savepoint.save // --- Pool -void_pool void_pool_create(arena* a, u64 capacity, u64 entry_size) { +void_pool void_pool_create(arena* a, const char* debug_label, u64 capacity, u64 entry_size) { size_t memory_requirements = capacity * entry_size; void* backing_buf = arena_alloc(a, memory_requirements); + assert(entry_size >= sizeof(void_pool_header)); // TODO: create my own assert with error message + void_pool pool = { .capacity = capacity, .entry_size = entry_size, .count = 0, .backing_buffer = backing_buf, - .free_list_head = NULL }; + .free_list_head = NULL, + .debug_label = debug_label }; void_pool_free_all(&pool); @@ -99,7 +102,7 @@ void* void_pool_alloc(void_pool* pool, u32* out_raw_handle) { uintptr_t start = (uintptr_t)pool->backing_buffer; uintptr_t cur = (uintptr_t)free_node; TRACE("%ld %ld ", start, cur); - /* assert(cur > start); */ + assert(cur > start); u32 index = (u32)((cur - start) / pool->entry_size); printf("Index %d\n", index); if (out_raw_handle != NULL) { |