diff options
author | dec05eba <dec05eba@protonmail.com> | 2019-02-24 02:10:58 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-07-25 14:36:40 +0200 |
commit | 11dc4b81935e3dfee997c421d8d6fa166edd7a05 (patch) | |
tree | ccb08be54209a4900c740c9ed58e8f9c2910811d /include/buffer.h |
Initial commit, Function declaration work somewhat
Diffstat (limited to 'include/buffer.h')
-rw-r--r-- | include/buffer.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/buffer.h b/include/buffer.h new file mode 100644 index 0000000..57efe9e --- /dev/null +++ b/include/buffer.h @@ -0,0 +1,22 @@ +#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; + +void buffer_init(Buffer *self); +void buffer_deinit(Buffer *self); + +WARN_UNUSED_RESULT int buffer_append(Buffer *self, void *data, usize size); +void* buffer_get(Buffer *self, usize index, usize type_size); + +#endif
\ No newline at end of file |