2 * Sherlock Library -- Fast Buffered I/O on Static Buffers
4 * (c) 2003 Martin Mares <mj@ucw.cz>
5 * (c) 2004 Robert Spalek <robert@ucw.cz>
7 * This software may be freely distributed and used according to the terms
8 * of the GNU Lesser General Public License.
12 #include "lib/fastbuf.h"
15 fbbuf_refill(struct fastbuf *f UNUSED)
21 fbbuf_init_read(struct fastbuf *f, byte *buf, uns size)
23 f->buffer = f->bptr = buf;
24 f->bstop = f->bufend = buf + size;
25 f->name = "fbbuf-read";
27 f->refill = fbbuf_refill;
32 f->can_overwrite_buffer = 1;
36 fbbuf_spout(struct fastbuf *f UNUSED)
38 die("fbbuf: buffer overflow on write");
42 fbbuf_init_write(struct fastbuf *f, byte *buf, uns size)
44 f->buffer = f->bstop = f->bptr = buf;
45 f->bufend = buf + size;
46 f->name = "fbbuf-write";
49 f->spout = fbbuf_spout;
53 f->can_overwrite_buffer = 0;