Implement Allocator wrapper for memory context
This commit is contained in:
parent
03d2a59948
commit
8a58a1cc48
@ -1,6 +1,7 @@
|
||||
#ifndef MEM_CTX_H
|
||||
#define MEM_CTX_H
|
||||
|
||||
#include "mem_allocator.h"
|
||||
#include "mem_arena.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -14,6 +15,7 @@ typedef enum {
|
||||
COUNT_CTX_DEST_BUFFER,
|
||||
} CTXDestBuffer;
|
||||
|
||||
Allocator wapp_mem_ctx_allocator(CTXDestBuffer buffer);
|
||||
void wapp_mem_ctx_init(u64 main_buf_capacity, u64 temp_buf_capacity);
|
||||
void *wapp_mem_ctx_alloc(CTXDestBuffer buffer, u64 size);
|
||||
void *wapp_mem_ctx_alloc_aligned(CTXDestBuffer buffer, u64 size, u64 alignment);
|
||||
|
@ -16,6 +16,11 @@ internal MemCTX g_context = {0};
|
||||
|
||||
internal Arena *get_arena(CTXDestBuffer buffer);
|
||||
|
||||
Allocator wapp_mem_ctx_allocator(CTXDestBuffer buffer) {
|
||||
Arena *arena = get_arena(buffer);
|
||||
return wapp_mem_arena_allocator(arena);
|
||||
}
|
||||
|
||||
void wapp_mem_ctx_init(u64 main_buf_capacity, u64 temp_buf_capacity) {
|
||||
g_context.main_initialised =
|
||||
wapp_mem_arena_init(&g_context.main, main_buf_capacity);
|
||||
|
Loading…
Reference in New Issue
Block a user