esc
Externally Scriptable Editor
git clone git://mccd.space/esc
| Log | Files | Refs | README |
strbuf.h (487B)
1 #ifndef STRBUF_H
2 #define STRBUF_H
3
4 #include <stddef.h>
5 #include <stdbool.h>
6
7 typedef struct {
8 char *data;
9 size_t len;
10 size_t cap;
11 } StrBuf;
12
13 void strbuf_init(StrBuf *sb, size_t init_cap);
14 void strbuf_free(StrBuf *sb);
15
16 bool strbuf_insert(StrBuf *sb, size_t pos, const char *text, size_t text_len);
17 void strbuf_delete(StrBuf *sb, size_t pos, size_t len);
18
19 bool strbuf_read_file(StrBuf *sb, const char *filename);
20 bool strbuf_write_file(const StrBuf *sb, const char *filename);
21
22 #endif