Am 03.11.2015 um 11:52 schrieb Gerd Hoffmann:
diff --git a/include/io/buffer.h b/include/io/buffer.h
index f63869e..43688cc 100644
--- a/include/io/buffer.h
+++ b/include/io/buffer.h
@@ -39,6 +39,8 @@ struct QIOBuffer {
      size_t offset;
      uint64_t avg_size;
      uint8_t *buffer;
+    size_t base_offs;
+    uint8_t *base_ptr;
Why a separate base_ptr?

While being at it I'd much prefer to replace offset with start & end.
The buffer content is buffer[start] ... buffer[end-1] then.

We can allow the buffer to wrap around, i.e. end < start.  Buffer
content is buf[start] ... buffer[size-1] and buffer[0] .. buffer[end-1]
then.  Makes the buffer management a bit more complicated, but we never
have to memmove then (except when changing buffer size) and the
WASTED_SIZE logic isn't needed too ...

Then drop this patch and try to use your approach for 2.6+

Peter


Reply via email to