From 76d85a10f6cda93eba29dad5372e8160af7289c8 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 27 Feb 2019 22:26:35 +0100 Subject: Use multiple threads to parse --- include/std/scoped_allocator.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 include/std/scoped_allocator.h (limited to 'include/std/scoped_allocator.h') diff --git a/include/std/scoped_allocator.h b/include/std/scoped_allocator.h new file mode 100644 index 0000000..fdaee2a --- /dev/null +++ b/include/std/scoped_allocator.h @@ -0,0 +1,31 @@ +#ifndef AMALGAM_SCOPED_ALLOCATOR_H +#define AMALGAM_SCOPED_ALLOCATOR_H + +#include "misc.h" +#include "types.h" +#include "buffer.h" + +typedef struct ScopedAllocatorNode ScopedAllocatorNode; +typedef struct ScopedAllocator ScopedAllocator; + +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 \ No newline at end of file -- cgit v1.2.3