]> mj.ucw.cz Git - libucw.git/blobdiff - lib/fastbuf.h
New functions for manipulating attribute lists: obj_prepend_attr()
[libucw.git] / lib / fastbuf.h
index a796a3c749b4ced91e835907359c7c9e2b343bbd..2948830ee4e0331e305a9c5a9ceb66486ca738db 100644 (file)
@@ -11,6 +11,8 @@
 #include <stdio.h>
 #endif
 
+#include <string.h>
+
 #include "lib/unaligned.h"
 
 /*
@@ -57,6 +59,7 @@ struct fastbuf {
 /* FastIO on standard files */
 
 struct fastbuf *bopen(byte *name, uns mode, uns buffer);
+struct fastbuf *bopen_tmp(uns buffer);
 struct fastbuf *bfdopen(int fd, uns buffer);
 void bbcopy(struct fastbuf *f, struct fastbuf *t, uns l);
 
@@ -89,13 +92,13 @@ static inline int bpeekc(struct fastbuf *f)
   return (f->bptr < f->bstop) ? (int) *f->bptr : bpeekc_slow(f);
 }
 
-static inline void bungetc(struct fastbuf *f, byte c)
+static inline void bungetc(struct fastbuf *f)
 {
-  *--f->bptr = c;
+  f->bptr--;
 }
 
-void bputc_slow(struct fastbuf *f, byte c);
-static inline void bputc(struct fastbuf *f, byte c)
+void bputc_slow(struct fastbuf *f, uns c);
+static inline void bputc(struct fastbuf *f, uns c)
 {
   if (f->bptr < f->bufend)
     *f->bptr++ = c;
@@ -159,8 +162,8 @@ static inline u64 bget5(struct fastbuf *f)
     return bget5_slow(f);
 }
 
-void bputw_slow(struct fastbuf *f, word w);
-static inline void bputw(struct fastbuf *f, word w)
+void bputw_slow(struct fastbuf *f, uns w);
+static inline void bputw(struct fastbuf *f, uns w)
 {
   if (f->bptr + 2 <= f->bufend)
     {