# HG changeset patch # User Mike Becker # Date 1361791111 -3600 # Node ID 0ef0df7aa2c2a31cf7d4f5e42743b8591a0b2f86 # Parent 7465c18765dc937f942b3072c8cc4f96328cdf66 fixed comments + added ucx_buffer_clear diff -r 7465c18765dc -r 0ef0df7aa2c2 ucx/buffer.h --- a/ucx/buffer.h Tue Feb 19 17:15:30 2013 +0100 +++ b/ucx/buffer.h Mon Feb 25 12:18:31 2013 +0100 @@ -9,7 +9,9 @@ extern "C" { #endif +/* no autoextend or autofree behaviour */ #define UCX_BUFFER_DEFAULT 0x00 +/* the buffer shall free the occupied memory space */ #define UCX_BUFFER_AUTOFREE 0x01 /* the buffer may automatically double its size on write operations */ #define UCX_BUFFER_AUTOEXTEND 0x02 @@ -44,13 +46,16 @@ * SEEK_CUR marks the current position * SEEK_END marks the first 0-byte in the buffer * - * ucx_memseek returns 0 on success and -1 if the new position is beyond the + * ucx_buffer_seek returns 0 on success and -1 if the new position is beyond the * bounds of the allocated buffer. In that case the position of the buffer * remains unchanged. * */ int ucx_buffer_seek(UcxBuffer *buffer, off_t offset, int whence); +#define ucx_buffer_clear(buffer) memset(buffer->space, 0, buffer->size); \ + buffer->size = 0; buffer->pos = 0; + /* * returns non-zero, if the current buffer position has exceeded the last * available byte of the underlying buffer