]> mj.ucw.cz Git - libucw.git/blobdiff - lib/fb-buffer.c
Arranged the module list.
[libucw.git] / lib / fb-buffer.c
index 2f52665f1bfbb879d69b9adaec550499b99a09e7..574874f0a11aa2545f29ad5716394324b688f3cd 100644 (file)
@@ -1,8 +1,7 @@
 /*
  *     Sherlock Library -- Fast Buffered I/O on Static Buffers
  *
 /*
  *     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.
  *
  *     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"
 
 #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)
 {
 static int
 fbbuf_refill(struct fastbuf *f UNUSED)
 {
@@ -31,7 +17,7 @@ fbbuf_refill(struct fastbuf *f UNUSED)
 }
 
 void
 }
 
 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->buffer = f->bptr = buf;
   f->bstop = f->bufend = buf + size;
@@ -41,7 +27,8 @@ fbbuf_init_read(struct fastbuf *f, byte *buf, uns size)
   f->spout = NULL;
   f->seek = NULL;
   f->close = NULL;
   f->spout = NULL;
   f->seek = NULL;
   f->close = NULL;
-  f->config = fbbuf_config;
+  f->config = NULL;
+  f->can_overwrite_buffer = can_overwrite;
 }
 
 static void
 }
 
 static void
@@ -61,5 +48,6 @@ fbbuf_init_write(struct fastbuf *f, byte *buf, uns size)
   f->spout = fbbuf_spout;
   f->seek = NULL;
   f->close = NULL;
   f->spout = fbbuf_spout;
   f->seek = NULL;
   f->close = NULL;
-  f->config = fbbuf_config;
+  f->config = NULL;
+  f->can_overwrite_buffer = 0;
 }
 }