diff options
author | tomsmeding <tom.smeding@gmail.com> | 2019-11-23 23:39:04 +0100 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2019-11-23 23:39:04 +0100 |
commit | 0d2c5f9602db67810c1c9551ca59ac840339b56b (patch) | |
tree | 2f5caa1dae7cb029c25eb031da75ca005caa1ee3 /plugins/static/buffer.h | |
parent | 4381cca95136b0a8222378a41ac0ebb1bc62ea80 (diff) |
static: Move struct buffer to a separate file
Diffstat (limited to 'plugins/static/buffer.h')
-rw-r--r-- | plugins/static/buffer.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/plugins/static/buffer.h b/plugins/static/buffer.h new file mode 100644 index 0000000..0237f7c --- /dev/null +++ b/plugins/static/buffer.h @@ -0,0 +1,21 @@ +#pragma once + +#include <stdbool.h> +#include <stddef.h> + + +struct buffer { + char *buf; + size_t cap, len; +}; + +struct buffer buffer_make(size_t capacity); + +void buffer_free(struct buffer buffer); + +void buffer_append_mem(struct buffer *buffer, const char *str, size_t len); + +void buffer_append_str(struct buffer *buffer, const char *str); + +// returns whether successful +bool buffer_append_file(struct buffer *buffer, const char *path); |