summaryrefslogtreecommitdiff
path: root/plugins/static/buffer.h
blob: 0237f7c75207e055776d5e46bc7e9b22c5f1d13b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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);