diff options
author | dec05eba <dec05eba@protonmail.com> | 2019-02-27 22:26:35 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-07-25 14:36:46 +0200 |
commit | 76d85a10f6cda93eba29dad5372e8160af7289c8 (patch) | |
tree | cfec3043ec45a5e83494ec109e87c239dad6cc47 /include/std/buffer.h | |
parent | 8201cd9f40897cf6b8e6973b28a8661108702ab1 (diff) |
Use multiple threads to parse
Diffstat (limited to 'include/std/buffer.h')
-rw-r--r-- | include/std/buffer.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/include/std/buffer.h b/include/std/buffer.h new file mode 100644 index 0000000..ed87f29 --- /dev/null +++ b/include/std/buffer.h @@ -0,0 +1,23 @@ +#ifndef AMALGAM_BUFFER_H +#define AMALGAM_BUFFER_H + +#include "types.h" +#include "misc.h" + +#define BUFFER_OK 0 +#define BUFFER_ALLOC_FAIL -1 + +typedef struct { + char* data; + usize size; + usize capacity; +} Buffer; + +struct ScopedAllocator; +CHECK_RESULT int buffer_init(Buffer *self, struct ScopedAllocator *allocator); + +CHECK_RESULT int buffer_append(Buffer *self, void *data, usize size); +void* buffer_get(Buffer *self, usize index, usize type_size); +CHECK_RESULT int buffer_pop(Buffer *self, void *data, usize size); + +#endif
\ No newline at end of file |