]> mj.ucw.cz Git - libucw.git/blobdiff - lib/fastbuf.h
sped up approximately 6 times:
[libucw.git] / lib / fastbuf.h
index 8699fe40ef4ceea1f4015d64215f0acdb85945d6..2ed05341dbcaa42b7268b09abd83de112024aba6 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *     Sherlock Library -- Fast Buffered I/O
  *
- *     (c) 1997--2002 Martin Mares <mj@ucw.cz>
+ *     (c) 1997--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.
@@ -15,7 +15,6 @@
 #endif
 
 #include <string.h>
-#include <stdarg.h>
 
 #include "lib/unaligned.h"
 
@@ -86,6 +85,16 @@ struct fastbuf *bopen_mm(byte *name, uns mode);
 
 struct fastbuf *bopen_limited_fd(int fd, uns bufsize, uns limit);
 
+/* FastIO on static buffers */
+
+void fbbuf_init_read(struct fastbuf *f, byte *buffer, uns size);
+void fbbuf_init_write(struct fastbuf *f, byte *buffer, uns size);
+static inline uns
+fbbuf_count_written(struct fastbuf *f)
+{
+  return f->bptr - f->bstop;
+}
+
 /* Configuring stream parameters */
 
 int bconfig(struct fastbuf *f, uns type, int data);
@@ -98,6 +107,7 @@ void bclose(struct fastbuf *f);
 void bflush(struct fastbuf *f);
 void bseek(struct fastbuf *f, sh_off_t pos, int whence);
 void bsetpos(struct fastbuf *f, sh_off_t pos);
+void brewind(struct fastbuf *f);
 
 static inline sh_off_t btell(struct fastbuf *f)
 {