ucx/buffer.c

changeset 63
1d3500806565
parent 62
6814aea8462d
child 64
16590c9c497c
--- a/ucx/buffer.c	Wed Oct 10 10:46:20 2012 +0200
+++ b/ucx/buffer.c	Wed Oct 10 13:58:51 2012 +0200
@@ -3,13 +3,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-struct UcxBuffer {
-    void *space;
-    size_t pos;
-    size_t size;
-    int flags;
-};
-
 UcxBuffer *ucx_buffer_new(void *space, size_t length, int flags) {
     UcxBuffer *buffer = (UcxBuffer*) malloc(sizeof(UcxBuffer));
     if (buffer) {
@@ -34,7 +27,7 @@
 }
 
 void ucx_buffer_free(UcxBuffer *buffer) {
-    if (ucx_buffer_testflags(buffer, UCX_BUFFER_AUTOFREE)) {
+    if ((buffer->flags & UCX_BUFFER_AUTOFREE) == UCX_BUFFER_AUTOFREE) {
         free(buffer->space);
     }
     free(buffer);
@@ -93,18 +86,6 @@
     return buffer->pos >= buffer->size;
 }
 
-size_t ucx_buffer_tell(UcxBuffer *buffer) {
-    return buffer->pos;
-}
-
-size_t ucx_buffer_size(UcxBuffer *buffer) {
-    return buffer->size;
-}
-
-int ucx_buffer_testflags(UcxBuffer *buffer, int flags) {
-    return (buffer->flags & flags) == flags;
-}
-
 size_t ucx_bufio(void* d, size_t s, size_t n, UcxBuffer *b, _Bool read) {
     size_t len;
     if (b->pos + s*n > b->size) {

mercurial