From 810082d15c244b8b29470d3bb1c6b11fc9a40c25 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Fri, 30 Oct 2015 12:09:57 +0100 Subject: buffer: add buffer_init Signed-off-by: Gerd Hoffmann Reviewed-by: Peter Lieven Reviewed-by: Daniel P. Berrange Message-id: 1446203414-4013-3-git-send-email-kraxel@redhat.com --- include/qemu/buffer.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'include') diff --git a/include/qemu/buffer.h b/include/qemu/buffer.h index b380cec..0710e16 100644 --- a/include/qemu/buffer.h +++ b/include/qemu/buffer.h @@ -34,12 +34,24 @@ typedef struct Buffer Buffer; */ struct Buffer { + char *name; size_t capacity; size_t offset; uint8_t *buffer; }; /** + * buffer_init: + * @buffer: the buffer object + * @name: buffer name + * + * Optionally attach a name to the buffer, to make it easier + * to identify in debug traces. + */ +void buffer_init(Buffer *buffer, const char *name, ...) + GCC_FMT_ATTR(2, 3); + +/** * buffer_reserve: * @buffer: the buffer object * @len: the minimum required free space -- cgit v1.1