gmio_core: remove useless gmio_stream utility functions

This commit is contained in:
Hugues Delorme 2015-03-30 17:26:11 +02:00
parent 55a985d3ee
commit e9ed4b511e
2 changed files with 13 additions and 28 deletions

View File

@ -19,14 +19,10 @@
#include <stdio.h>
#include <stdlib.h>
/* TODO: add cmake step to check availability of <sys/xxx.h> header files */
#include <sys/types.h>
#include <sys/stat.h>
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;
}

View File

@ -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);