2 * UCW Library -- Fast Buffered I/O on Static Buffers
4 * (c) 2003--2004 Martin Mares <mj@ucw.cz>
6 * This software may be freely distributed and used according to the terms
7 * of the GNU Lesser General Public License.
11 #include "lib/fastbuf.h"
14 fbbuf_refill(struct fastbuf *f UNUSED)
20 fbbuf_init_read(struct fastbuf *f, byte *buf, uns size, uns can_overwrite)
22 f->buffer = f->bptr = buf;
23 f->bstop = f->bufend = buf + size;
24 f->name = "fbbuf-read";
26 f->refill = fbbuf_refill;
31 f->can_overwrite_buffer = can_overwrite;
35 fbbuf_spout(struct fastbuf *f UNUSED)
37 die("fbbuf: buffer overflow on write");
41 fbbuf_init_write(struct fastbuf *f, byte *buf, uns size)
43 f->buffer = f->bstop = f->bptr = buf;
44 f->bufend = buf + size;
45 f->name = "fbbuf-write";
48 f->spout = fbbuf_spout;
52 f->can_overwrite_buffer = 0;