/*
* Sherlock Library -- Fast Buffered I/O on Static Buffers
*
- * (c) 2003 Martin Mares <mj@ucw.cz>
- * (c) 2004 Robert Spalek <robert@ucw.cz>
+ * (c) 2003--2004 Martin Mares <mj@ucw.cz>
*
* This software may be freely distributed and used according to the terms
* of the GNU Lesser General Public License.
#include "lib/lib.h"
#include "lib/fastbuf.h"
-static int
-fbbuf_config(struct fastbuf *f UNUSED, uns item, int value UNUSED)
-{
- switch (item)
- {
- case BCONFIG_CAN_OVERWRITE:
- // XXX: should we enable changing the value?
- return 1;
- default:
- return -1;
- }
-}
-
static int
fbbuf_refill(struct fastbuf *f UNUSED)
{
}
void
-fbbuf_init_read(struct fastbuf *f, byte *buf, uns size)
+fbbuf_init_read(struct fastbuf *f, byte *buf, uns size, uns can_overwrite)
{
f->buffer = f->bptr = buf;
f->bstop = f->bufend = buf + size;
f->spout = NULL;
f->seek = NULL;
f->close = NULL;
- f->config = fbbuf_config;
+ f->config = NULL;
+ f->can_overwrite_buffer = can_overwrite;
}
static void
f->spout = fbbuf_spout;
f->seek = NULL;
f->close = NULL;
- f->config = fbbuf_config;
+ f->config = NULL;
+ f->can_overwrite_buffer = 0;
}