diff options
| author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2023-06-11 15:40:26 +0200 | 
|---|---|---|
| committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2023-06-11 15:40:26 +0200 | 
| commit | 366ccf20745b23f1eb8554cbe17e6972271de002 (patch) | |
| tree | 93951efe96966db4c766c140431dd017fd15cf80 /include/io | |
| parent | ad1691aa33cfc1b1558ce10e93552d0eb1cdcd63 (diff) | |
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 <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include/io')
| -rw-r--r-- | include/io/istream.h | 13 | 
1 files changed, 2 insertions, 11 deletions
| 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;  }  /** | 
