aboutsummaryrefslogtreecommitdiff
path: root/buffer.h
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-05-11 20:34:23 +0200
committerMarc André Tanner <mat@brain-dump.org>2016-05-18 15:07:02 +0200
commit39b306f235f3faebb047c7cda82746781b9ea2f2 (patch)
treeee32dadea6657c5313febe086bed1e7ae630d421 /buffer.h
parent2c72e793c580d3ab149e7724a75b4be164c67aed (diff)
downloadvis-39b306f235f3faebb047c7cda82746781b9ea2f2.tar.gz
vis-39b306f235f3faebb047c7cda82746781b9ea2f2.tar.xz
buffer: add utility function to NUL terminate buffer
Diffstat (limited to 'buffer.h')
-rw-r--r--buffer.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/buffer.h b/buffer.h
index 1c9f684..6b44a53 100644
--- a/buffer.h
+++ b/buffer.h
@@ -22,6 +22,8 @@ void buffer_clear(Buffer*);
bool buffer_grow(Buffer*, size_t size);
/* truncate buffer, but keep associated memory region for further data */
void buffer_truncate(Buffer*);
+/* if buffer is not empty, make sure it is NUL terminated */
+bool buffer_terminate(Buffer*);
/* replace buffer content with given data, growing the buffer if needed */
bool buffer_put(Buffer*, const void *data, size_t len);
/* same but with NUL-terminated data */