From e9ed4b511eb2b9179a828c8809b86b84e37091fc Mon Sep 17 00:00:00 2001 From: Hugues Delorme Date: Mon, 30 Mar 2015 17:26:11 +0200 Subject: [PATCH] gmio_core: remove useless gmio_stream utility functions --- src/gmio_core/stream.c | 29 ++++++++++------------------- src/gmio_core/stream.h | 12 +++--------- 2 files changed, 13 insertions(+), 28 deletions(-) diff --git a/src/gmio_core/stream.c b/src/gmio_core/stream.c index 15a9c8e..3b93d4d 100644 --- a/src/gmio_core/stream.c +++ b/src/gmio_core/stream.c @@ -19,14 +19,10 @@ #include #include +/* TODO: add cmake step to check availability of header files */ #include #include -void gmio_stream_set_null(gmio_stream_t* stream) -{ - memset(stream, 0, sizeof(gmio_stream_t)); -} - gmio_stream_t gmio_stream_null() { gmio_stream_t null_stream = { 0 }; @@ -67,20 +63,15 @@ static void gmio_stream_stdio_rewind(void* cookie) rewind((FILE*) cookie); } -void gmio_stream_set_stdio(gmio_stream_t* stream, FILE* file) -{ - stream->cookie = file; - stream->at_end_func = gmio_stream_stdio_at_end; - stream->error_func = gmio_stream_stdio_error; - stream->read_func = gmio_stream_stdio_read; - stream->write_func = gmio_stream_stdio_write; - stream->size_func = gmio_stream_stdio_size; - stream->rewind_func = gmio_stream_stdio_rewind; -} - gmio_stream_t gmio_stream_stdio(FILE* file) { - gmio_stream_t stdio_stream = { 0 }; - gmio_stream_set_stdio(&stdio_stream, file); - return stdio_stream; + gmio_stream_t stream = { 0 }; + stream.cookie = file; + stream.at_end_func = gmio_stream_stdio_at_end; + stream.error_func = gmio_stream_stdio_error; + stream.read_func = gmio_stream_stdio_read; + stream.write_func = gmio_stream_stdio_write; + stream.size_func = gmio_stream_stdio_size; + stream.rewind_func = gmio_stream_stdio_rewind; + return stream; } diff --git a/src/gmio_core/stream.h b/src/gmio_core/stream.h index 7d9988f..79c0845 100644 --- a/src/gmio_core/stream.h +++ b/src/gmio_core/stream.h @@ -88,11 +88,11 @@ struct gmio_stream */ size_t (*write_func)(void* cookie, const void* ptr, size_t size, size_t count); - /*! Pointer on function that returns the size(in bytes) of the stream */ + /*! Pointer on a function that returns the size(in bytes) of the stream */ size_t (*size_func)(void* cookie); - /*! Pointer on function that moves the position indicator within the stream - * to the beginning */ + /*! Pointer on a function that moves the position indicator within the + * stream to the beginning */ void (*rewind_func)(void* cookie); }; @@ -102,15 +102,9 @@ GMIO_C_LINKAGE_BEGIN /* Initialization */ -/*! Installs a null stream */ -GMIO_LIB_EXPORT void gmio_stream_set_null(gmio_stream_t* stream); - /*! Returns a null stream */ GMIO_LIB_EXPORT gmio_stream_t gmio_stream_null(); -/*! Configures \p stream for standard FILE* (cookie will hold \p file) */ -GMIO_LIB_EXPORT void gmio_stream_set_stdio(gmio_stream_t* stream, FILE* file); - /*! Returns a stream for standard FILE* (cookie will hold \p file) */ GMIO_LIB_EXPORT gmio_stream_t gmio_stream_stdio(FILE* file);