From 366ccf20745b23f1eb8554cbe17e6972271de002 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sun, 11 Jun 2023 15:40:26 +0200 Subject: libio: remove precache from istream_advance_buffer Since the user has to call istream_get_buffered_data afterwards anyway, we can do the precache lazily. Signed-off-by: David Oberhollenzer --- include/io/istream.h | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'include/io') diff --git a/include/io/istream.h b/include/io/istream.h index 8edd61d..fca1440 100644 --- a/include/io/istream.h +++ b/include/io/istream.h @@ -141,24 +141,15 @@ SQFS_INLINE int istream_get_buffered_data(istream_t *strm, const sqfs_u8 **out, * * This marks the first `count` bytes of the internal buffer as used, * forcing @ref istream_get_buffered_data to return data afterwards - * and potentially to load more data. + * and potentially try to load more data. * * @param strm A pointer to an istream_t implementation. * @param count The number of bytes used up. - * - * @return Zero on success, a negative error code on failure. */ -SQFS_INLINE int istream_advance_buffer(istream_t *strm, size_t count) +SQFS_INLINE void istream_advance_buffer(istream_t *strm, size_t count) { - if (count >= strm->buffer_used) { - strm->buffer += strm->buffer_used; - strm->buffer_used = 0; - return strm->precache(strm); - } - strm->buffer += count; strm->buffer_used -= count; - return 0; } /** -- cgit v1.2.3