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_config(struct fastbuf *f UNUSED, uns item, int value UNUSED)
19 case BCONFIG_CAN_OVERWRITE:
20 // XXX: should we enable changing the value?
28 fbbuf_refill(struct fastbuf *f UNUSED)
34 fbbuf_init_read(struct fastbuf *f, byte *buf, uns size)
36 f->buffer = f->bptr = buf;
37 f->bstop = f->bufend = buf + size;
38 f->name = "fbbuf-read";
40 f->refill = fbbuf_refill;
44 f->config = fbbuf_config;
48 fbbuf_spout(struct fastbuf *f UNUSED)
50 die("fbbuf: buffer overflow on write");
54 fbbuf_init_write(struct fastbuf *f, byte *buf, uns size)
56 f->buffer = f->bstop = f->bptr = buf;
57 f->bufend = buf + size;
58 f->name = "fbbuf-write";
61 f->spout = fbbuf_spout;
64 f->config = fbbuf_config;