fixed comments + added ucx_buffer_clear

Mon, 25 Feb 2013 12:18:31 +0100

author
Mike Becker <universe@uap-core.de>
date
Mon, 25 Feb 2013 12:18:31 +0100
changeset 85
0ef0df7aa2c2
parent 84
7465c18765dc
child 86
55bf819cbc88

fixed comments + added ucx_buffer_clear

ucx/buffer.h file | annotate | diff | comparison | revisions
--- 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

mercurial