aboutsummaryrefslogtreecommitdiff
path: root/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/buffer.c b/buffer.c
index d8b01f7..410a059 100644
--- a/buffer.c
+++ b/buffer.c
@@ -29,6 +29,11 @@ void buffer_truncate(Buffer *buf) {
buf->len = 0;
}
+bool buffer_terminate(Buffer *buf) {
+ return !buf->data || buf->len == 0 || buf->data[buf->len-1] == '\0' ||
+ buffer_append(buf, "\0", 1);
+}
+
void buffer_release(Buffer *buf) {
if (!buf)
return;