summaryrefslogtreecommitdiffstats
path: root/stream/stream.h
diff options
context:
space:
mode:
Diffstat (limited to 'stream/stream.h')
-rw-r--r--stream/stream.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/stream/stream.h b/stream/stream.h
index a0cd3d58fc..b637461eda 100644
--- a/stream/stream.h
+++ b/stream/stream.h
@@ -215,6 +215,12 @@ inline static int64_t stream_tell(stream_t *s)
return s->pos + s->buf_pos - s->buf_len;
}
+// Return number of buffered bytes. (Useful for optimization purposes.)
+inline static int stream_buffered(stream_t *s)
+{
+ return s->buf_len - s->buf_pos;
+}
+
int stream_skip(stream_t *s, int64_t len);
int stream_seek(stream_t *s, int64_t pos);
int stream_read(stream_t *s, char *mem, int total);