From ccb43b0f6d3c1577ffb32053d8436aee69e0aea9 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Thu, 26 Jan 2023 15:44:26 +0100 Subject: libio: move simple wrappers back into header as inline functions Signed-off-by: David Oberhollenzer --- include/io/istream.h | 5 ++++- include/io/ostream.h | 17 +++++++++++++---- lib/io/istream.c | 5 ----- lib/io/ostream.c | 16 ---------------- 4 files changed, 17 insertions(+), 26 deletions(-) diff --git a/include/io/istream.h b/include/io/istream.h index 567d7e3..3280327 100644 --- a/include/io/istream.h +++ b/include/io/istream.h @@ -107,7 +107,10 @@ SQFS_INTERNAL int istream_precache(istream_t *strm); * * @return A string holding the underlying filename. */ -SQFS_INTERNAL const char *istream_get_filename(istream_t *strm); +SQFS_INLINE const char *istream_get_filename(istream_t *strm) +{ + return strm->get_filename(strm); +} /** * @brief Skip over a number of bytes in an input stream. diff --git a/include/io/ostream.h b/include/io/ostream.h index 15585f9..21850d4 100644 --- a/include/io/ostream.h +++ b/include/io/ostream.h @@ -56,8 +56,11 @@ extern "C" { * * @return Zero on success, -1 on failure. */ -SQFS_INTERNAL int ostream_append(ostream_t *strm, const void *data, - size_t size); +SQFS_INLINE int ostream_append(ostream_t *strm, const void *data, + size_t size) +{ + return strm->append(strm, data, size); +} /** * @brief Append a number of zero bytes to an output stream. @@ -89,7 +92,10 @@ SQFS_INTERNAL int ostream_append_sparse(ostream_t *strm, size_t size); * * @return Zero on success, -1 on failure. */ -SQFS_INTERNAL int ostream_flush(ostream_t *strm); +SQFS_INLINE int ostream_flush(ostream_t *strm) +{ + return strm->flush(strm); +} /** * @brief Get the underlying filename of a output stream. @@ -100,7 +106,10 @@ SQFS_INTERNAL int ostream_flush(ostream_t *strm); * * @return A string holding the underlying filename. */ -SQFS_INTERNAL const char *ostream_get_filename(ostream_t *strm); +SQFS_INLINE const char *ostream_get_filename(ostream_t *strm) +{ + return strm->get_filename(strm); +} /** * @brief Printf like function that appends to an output stream diff --git a/lib/io/istream.c b/lib/io/istream.c index 6318a23..64fa478 100644 --- a/lib/io/istream.c +++ b/lib/io/istream.c @@ -58,11 +58,6 @@ int istream_precache(istream_t *strm) return strm->precache(strm); } -const char *istream_get_filename(istream_t *strm) -{ - return strm->get_filename(strm); -} - int istream_skip(istream_t *strm, sqfs_u64 size) { size_t diff; diff --git a/lib/io/ostream.c b/lib/io/ostream.c index afe76e8..da0b7b3 100644 --- a/lib/io/ostream.c +++ b/lib/io/ostream.c @@ -26,12 +26,6 @@ static int append_sparse_fallback(ostream_t *strm, size_t size) return 0; } - -int ostream_append(ostream_t *strm, const void *data, size_t size) -{ - return strm->append(strm, data, size); -} - int ostream_append_sparse(ostream_t *strm, size_t size) { if (strm->append_sparse == NULL) @@ -40,16 +34,6 @@ int ostream_append_sparse(ostream_t *strm, size_t size) return strm->append_sparse(strm, size); } -int ostream_flush(ostream_t *strm) -{ - return strm->flush(strm); -} - -const char *ostream_get_filename(ostream_t *strm) -{ - return strm->get_filename(strm); -} - sqfs_s32 ostream_append_from_istream(ostream_t *out, istream_t *in, sqfs_u32 size) { -- cgit v1.2.3