#ifndef AMALGAM_SCOPED_ALLOCATOR_H #define AMALGAM_SCOPED_ALLOCATOR_H #include "defs.h" #include "misc.h" #include "types.h" #include "buffer.h" struct ScopedAllocatorNode { char *data; usize size; ScopedAllocatorNode *next; }; struct ScopedAllocator { ScopedAllocatorNode head; ScopedAllocatorNode *current; Buffer/**/ buffers; }; CHECK_RESULT int scoped_allocator_node_init(ScopedAllocatorNode *self); void scoped_allocator_node_deinit(ScopedAllocatorNode *self); CHECK_RESULT int scoped_allocator_init(ScopedAllocator *self); void scoped_allocator_deinit(ScopedAllocator *self); CHECK_RESULT int scoped_allocator_alloc(ScopedAllocator *self, usize size, void **mem); CHECK_RESULT int scoped_allocator_add_buffer(ScopedAllocator *self, Buffer *buffer); #endif