Mon, 25 Feb 2013 12:18:31 +0100
fixed comments + added ucx_buffer_clear
ucx/buffer.h | file | annotate | diff | comparison | revisions |
1.1 --- a/ucx/buffer.h Tue Feb 19 17:15:30 2013 +0100 1.2 +++ b/ucx/buffer.h Mon Feb 25 12:18:31 2013 +0100 1.3 @@ -9,7 +9,9 @@ 1.4 extern "C" { 1.5 #endif 1.6 1.7 +/* no autoextend or autofree behaviour */ 1.8 #define UCX_BUFFER_DEFAULT 0x00 1.9 +/* the buffer shall free the occupied memory space */ 1.10 #define UCX_BUFFER_AUTOFREE 0x01 1.11 /* the buffer may automatically double its size on write operations */ 1.12 #define UCX_BUFFER_AUTOEXTEND 0x02 1.13 @@ -44,13 +46,16 @@ 1.14 * SEEK_CUR marks the current position 1.15 * SEEK_END marks the first 0-byte in the buffer 1.16 * 1.17 - * ucx_memseek returns 0 on success and -1 if the new position is beyond the 1.18 + * ucx_buffer_seek returns 0 on success and -1 if the new position is beyond the 1.19 * bounds of the allocated buffer. In that case the position of the buffer 1.20 * remains unchanged. 1.21 * 1.22 */ 1.23 int ucx_buffer_seek(UcxBuffer *buffer, off_t offset, int whence); 1.24 1.25 +#define ucx_buffer_clear(buffer) memset(buffer->space, 0, buffer->size); \ 1.26 + buffer->size = 0; buffer->pos = 0; 1.27 + 1.28 /* 1.29 * returns non-zero, if the current buffer position has exceeded the last 1.30 * available byte of the underlying buffer