]> mj.ucw.cz Git - libucw.git/blobdiff - ucw/fb-grow.c
Opt: Calling hooks, config opts added
[libucw.git] / ucw / fb-grow.c
index 59eff2b72ec44184c69a36a8a0da181d624f8a29..0898a1a4be68b6128796bdc866f0598f77024942 100644 (file)
@@ -7,9 +7,9 @@
  *     of the GNU Lesser General Public License.
  */
 
-#include "ucw/lib.h"
-#include "ucw/fastbuf.h"
-#include "ucw/mempool.h"
+#include <ucw/lib.h>
+#include <ucw/fastbuf.h>
+#include <ucw/mempool.h>
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -19,7 +19,7 @@ struct fb_gbuf {
   struct mempool *mp;
   byte *end;
 };
-#define FB_GBUF(f) ((struct fb_gbuf *)(f)->is_fastbuf)
+#define FB_GBUF(f) ((struct fb_gbuf *)(f))
 
 static int fbgrow_refill(struct fastbuf *b)
 {
@@ -56,7 +56,7 @@ static int fbgrow_seek(struct fastbuf *b, ucw_off_t pos, int whence)
   if (whence == SEEK_END)
     pos += len;
   if (pos < 0 || pos > len)
-    bthrow(b, "fb.seek", "Seek out of range");
+    bthrow(b, "seek", "Seek out of range");
   b->bptr = b->buffer + pos;
   b->bstop = b->buffer;
   b->pos = 0;
@@ -92,7 +92,7 @@ struct fastbuf *fbgrow_create_mp(struct mempool *mp, unsigned basic_size)
   b->spout = fbgrow_spout;
   b->seek = fbgrow_seek;
   b->can_overwrite_buffer = 1;
-  return fb_tie(b);
+  return b;
 }
 
 struct fastbuf *fbgrow_create(unsigned basic_size)
@@ -111,11 +111,11 @@ void fbgrow_rewind(struct fastbuf *b)
   brewind(b);
 }
 
-uns fbgrow_read_all(struct fastbuf *b, byte **buf)
+uns fbgrow_get_buf(struct fastbuf *b, byte **buf)
 {
   byte *end = FB_GBUF(b)->end;
   end = MAX(end, b->bptr);
-  if (*buf)
+  if (buf)
     *buf = b->buffer;
   return end - b->buffer;
 }