diff buffer_heap.c @ 261:6795f8427fed

buffer: allow buffer truncation This is a similar idea to the POSIX truncate() function. It sets the used buffer size to a certain value. If the new size is larger than the old size, the newly visible bytes are zeroed out. If the new size is smaller than the old size, the bytes at the end are "lost" but the underlying buffer allocation remains unchanged. Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
date Tue, 11 Jul 2017 00:39:14 +0300
parents f82b45b662c9
children 0fa2f6606c5e
line wrap: on
line diff
--- a/buffer_heap.c	Sat Jul 08 09:53:45 2017 +0300
+++ b/buffer_heap.c	Tue Jul 11 00:39:14 2017 +0300
@@ -25,5 +25,6 @@
 const struct buffer_ops heap_buffer = {
 	.realloc = realloc,
 	.free = free,
+	.clear = generic_buffer_clear_memset,
 	.copyin = generic_buffer_copyin_memcpy,
 };