#ifndef AMALGAM_SCOPED_ALLOCATOR_H #define AMALGAM_SCOPED_ALLOCATOR_H #include "misc.h" #include "types.h" typedef struct ScopedAllocatorNode ScopedAllocatorNode; struct ScopedAllocatorNode { char *data; usize size; ScopedAllocatorNode *next; }; typedef struct { ScopedAllocatorNode head; ScopedAllocatorNode *current; } ScopedAllocator; 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); #endif