diff options
Diffstat (limited to 'textbuf.h')
-rw-r--r-- | textbuf.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/textbuf.h b/textbuf.h new file mode 100644 index 0000000..e5e0f03 --- /dev/null +++ b/textbuf.h @@ -0,0 +1,22 @@ +/* + * textbuf.h: A simple dynamic text buffer. + * + * This file provides the `textbuf` struct, which is a dynamically allocated + * buffer of text. + */ + +#ifndef _BUFFER_H +#define _BUFFER_H + +#include <stddef.h> + +struct textbuf { + char *buffer; + size_t length; +}; + +struct textbuf textbuf_init(); +void textbuf_append(struct textbuf *textbuf, const char *str, int len); +void textbuf_free(struct textbuf *textbuf); + +#endif |