X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=ucw%2Ffb-grow.c;h=0898a1a4be68b6128796bdc866f0598f77024942;hb=97d134124cb7f43e34a976e0d6a79622c67cb455;hp=59eff2b72ec44184c69a36a8a0da181d624f8a29;hpb=2b444219ce6ae0b0bb74b41cb02d6bc26d3f7ad1;p=libucw.git diff --git a/ucw/fb-grow.c b/ucw/fb-grow.c index 59eff2b7..0898a1a4 100644 --- a/ucw/fb-grow.c +++ b/ucw/fb-grow.c @@ -7,9 +7,9 @@ * of the GNU Lesser General Public License. */ -#include "ucw/lib.h" -#include "ucw/fastbuf.h" -#include "ucw/mempool.h" +#include +#include +#include #include #include @@ -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; }