]> mj.ucw.cz Git - libucw.git/blobdiff - lib/fastbuf.h
sped up approximately 6 times:
[libucw.git] / lib / fastbuf.h
index ebc69955fb7720e7ebc192651745d705ba8c5d10..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.
@@ -81,6 +81,20 @@ struct fastbuf *fbmem_clone_read(struct fastbuf *);  /* Create reading fastbuf */
 
 struct fastbuf *bopen_mm(byte *name, uns mode);
 
+/* FastI on file descriptors with limit */
+
+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);
@@ -93,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)
 {
@@ -267,6 +282,7 @@ static inline void bwrite(struct fastbuf *f, void *b, uns l)
 }
 
 byte *bgets(struct fastbuf *f, byte *b, uns l);        /* Non-std */
+int bgets_nodie(struct fastbuf *f, byte *b, uns l);
 byte *bgets0(struct fastbuf *f, byte *b, uns l);
 
 static inline void
@@ -345,4 +361,9 @@ bdirect_write_commit(struct fastbuf *f, byte *pos)
   f->bptr = pos;
 }
 
+/* Formatted output */
+
+int bprintf(struct fastbuf *b, byte *msg, ...);
+int vbprintf(struct fastbuf *b, byte *msg, va_list args);
+
 #endif