sh_off_t pos; /* Position of buffer start in the file */
sh_off_t fdpos; /* Current position in the non-buffered file */
int fd; /* File descriptor, -1 if not a real file */
+ int is_temp_file; /* Is a temporary file, delete on close */
void *lldata; /* Data private to access functions below */
void *llpos; /* ... continued ... */
int (*refill)(struct fastbuf *); /* Get a buffer with new data */
bput5_slow(f, l);
}
-uns bread_slow(struct fastbuf *f, void *b, uns l);
+uns bread_slow(struct fastbuf *f, void *b, uns l, uns check);
static inline uns bread(struct fastbuf *f, void *b, uns l)
{
if (f->bptr + l <= f->bstop)
return l;
}
else
- return bread_slow(f, b, l);
+ return bread_slow(f, b, l, 0);
+}
+
+static inline uns breadb(struct fastbuf *f, void *b, uns l)
+{
+ if (f->bptr + l <= f->bstop)
+ {
+ memcpy(b, f->bptr, l);
+ f->bptr += l;
+ return l;
+ }
+ else
+ return bread_slow(f, b, l, 1);
}
void bwrite_slow(struct fastbuf *f, void *b, uns l);
}
byte *bgets(struct fastbuf *f, byte *b, uns l); /* Non-std */
+byte *bgets0(struct fastbuf *f, byte *b, uns l);
static inline void
bputs(struct fastbuf *f, byte *b)
bwrite(f, b, strlen(b));
}
+static inline void
+bputs0(struct fastbuf *f, byte *b)
+{
+ bwrite(f, b, strlen(b)+1);
+}
+
static inline void
bputsn(struct fastbuf *f, byte *b)
{
#define bputo(f,l) bput5(f,l)
#define bgetp(f) bgetq(f)
#define bputp(f,l) bputq(f,l)
+#define FASTBUF_BYTES_PER_O 5
+#define FASTBUF_BYTES_PER_P 8
#else
#define bgeto(f) bgetl(f)
#define bputo(f,l) bputl(f,l)
#define bgetp(f) bgetl(f)
#define bputp(f,l) bputl(f,l)
+#define FASTBUF_BYTES_PER_O 4
+#define FASTBUF_BYTES_PER_P 4
#endif
#endif