Index: ChangeLog
===================================================================
--- ChangeLog	(revision 4515)
+++ ChangeLog	(revision 4516)
@@ -10,4 +10,5 @@
 	* Wrote authfile API.
 	* Changed SONAME version to 1.
+	* Changed buffer interface, no public struct anymore.
 
 v. 0.4beta0 - Fri Oct 01 2010 13:36 CEST
Index: include/libroar/buffer.h
===================================================================
--- include/libroar/buffer.h	(revision 3764)
+++ include/libroar/buffer.h	(revision 4516)
@@ -47,32 +47,16 @@
 #define ROAR_BUFFER_RESET                   1
 
-struct roar_buffer_ring {
- size_t read_pos;
- size_t write_pos;
+struct roar_buffer;
+
+struct roar_buffer_stats {
+ size_t parts;
+ size_t bytes;
+ size_t memory_usage;
 };
 
-struct roar_buffer {
- size_t               len;
- size_t               user_len;
- int                  flags;
- void               * data;
- void               * user_data;
- union {
-  void                    * vp;
-  int32_t                   i32;
-  struct roar_buffer_ring   ring;
- }                    meta;
- struct roar_buffer * next;
-};
+#define roar_buffer_next(a)    roar_buffer_delete(*(a), (a))
 
-struct roar_buffer_stats {
- int parts;
- int bytes;
- int memory_usage;
-};
+#define roar_buffer_new(a,len) roar_buffer_new_data((a), (len), NULL)
 
-#define roar_buffer_next(a) roar_buffer_delete(*(a), (a))
-
-int roar_buffer_new      (struct roar_buffer ** buf, size_t len);
 int roar_buffer_new_no_ma(struct roar_buffer ** buf, size_t len, void * data); // no internal malloc
 int roar_buffer_free     (struct roar_buffer *  buf);
@@ -84,5 +68,6 @@
 int roar_buffer_ring_new (struct roar_buffer ** buf, size_t len, int free_running);
 
-int roar_buffer_get_next (struct roar_buffer *  buf, struct roar_buffer ** next);
+int roar_buffer_clear_next (struct roar_buffer *  buf);
+int roar_buffer_get_next   (struct roar_buffer *  buf, struct roar_buffer ** next);
 
 int roar_buffer_get_data (struct roar_buffer *  buf, void   ** data);
Index: include/libroar/vio_magic.h
===================================================================
--- include/libroar/vio_magic.h	(revision 3811)
+++ include/libroar/vio_magic.h	(revision 4516)
@@ -40,6 +40,6 @@
 
 struct roar_vio_magic {
- struct roar_buffer inp;
- struct roar_stack  vios;
+ struct roar_buffer * inp;
+ struct roar_stack    vios;
 };
 
Index: libroar/buffer.c
===================================================================
--- libroar/buffer.c	(revision 3811)
+++ libroar/buffer.c	(revision 4516)
@@ -36,11 +36,23 @@
 #include "libroar.h"
 
-// TODO: convert this to a macro.
-// TODO: but still provide a function->symbol
-// TODO: so we do not need to change SONAME-Version
-// TODO: Clean this up in next SONAME-Version
-int roar_buffer_new      (struct roar_buffer ** buf, size_t len) {
- return roar_buffer_new_data(buf, len, NULL);
-}
+struct roar_buffer_ring {
+ size_t read_pos;
+ size_t write_pos;
+};
+
+struct roar_buffer {
+ size_t               refc;
+ size_t               len;
+ size_t               user_len;
+ int                  flags;
+ void               * data;
+ void               * user_data;
+ union {
+  void                    * vp;
+  int32_t                   i32;
+  struct roar_buffer_ring   ring;
+ }                    meta;
+ struct roar_buffer * next;
+};
 
 int roar_buffer_new_data (struct roar_buffer ** buf, size_t len, void ** data) {
@@ -171,4 +183,13 @@
 
  ROAR_DBG("buffer_add(*): adding buffer at deep %u", deep);
+
+ return 0;
+}
+
+int roar_buffer_clear_next (struct roar_buffer *  buf) {
+ if ( buf == NULL )
+  return -1;
+
+ buf->next = NULL;
 
  return 0;
Index: libroar/vio_magic.c
===================================================================
--- libroar/vio_magic.c	(revision 3811)
+++ libroar/vio_magic.c	(revision 4516)
@@ -51,5 +51,5 @@
   return -1;
 
- inp = &(self->inp);
+ inp = self->inp;
 
  if ( roar_buffer_get_len(inp, &len) == -1 )
Index: roarclients/roartypes.c
===================================================================
--- roarclients/roartypes.c	(revision 3811)
+++ roarclients/roartypes.c	(revision 4516)
@@ -29,5 +29,5 @@
 int main (void) {
  struct { char * name; int len; } types[] = {
-  { "roar_buffer",         sizeof(struct roar_buffer)         },
+//  { "roar_buffer",         sizeof(struct roar_buffer)         },
   { "roar_stack",          sizeof(struct roar_stack)          },
   { "roar_message",        sizeof(struct roar_message)        },
Index: roard/streams.c
===================================================================
--- roard/streams.c	(revision 4417)
+++ roard/streams.c	(revision 4516)
@@ -1547,5 +1547,5 @@
  }
 
- buf->next = NULL;
+ roar_buffer_clear_next(buf);
 
  roar_buffer_add(buf, g_streams[id]->buffer);
