gmio_core: remove useless gmio_stream utility functions
This commit is contained in:
parent
55a985d3ee
commit
e9ed4b511e
@ -19,14 +19,10 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
/* TODO: add cmake step to check availability of <sys/xxx.h> header files */
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.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 gmio_stream_null()
|
||||||
{
|
{
|
||||||
gmio_stream_t null_stream = { 0 };
|
gmio_stream_t null_stream = { 0 };
|
||||||
@ -67,20 +63,15 @@ static void gmio_stream_stdio_rewind(void* cookie)
|
|||||||
rewind((FILE*) 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 gmio_stream_stdio(FILE* file)
|
||||||
{
|
{
|
||||||
gmio_stream_t stdio_stream = { 0 };
|
gmio_stream_t stream = { 0 };
|
||||||
gmio_stream_set_stdio(&stdio_stream, file);
|
stream.cookie = file;
|
||||||
return stdio_stream;
|
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;
|
||||||
}
|
}
|
||||||
|
@ -88,11 +88,11 @@ struct gmio_stream
|
|||||||
*/
|
*/
|
||||||
size_t (*write_func)(void* cookie, const void* ptr, size_t size, size_t count);
|
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);
|
size_t (*size_func)(void* cookie);
|
||||||
|
|
||||||
/*! Pointer on function that moves the position indicator within the stream
|
/*! Pointer on a function that moves the position indicator within the
|
||||||
* to the beginning */
|
* stream to the beginning */
|
||||||
void (*rewind_func)(void* cookie);
|
void (*rewind_func)(void* cookie);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -102,15 +102,9 @@ GMIO_C_LINKAGE_BEGIN
|
|||||||
|
|
||||||
/* Initialization */
|
/* Initialization */
|
||||||
|
|
||||||
/*! Installs a null stream */
|
|
||||||
GMIO_LIB_EXPORT void gmio_stream_set_null(gmio_stream_t* stream);
|
|
||||||
|
|
||||||
/*! Returns a null stream */
|
/*! Returns a null stream */
|
||||||
GMIO_LIB_EXPORT gmio_stream_t gmio_stream_null();
|
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) */
|
/*! Returns a stream for standard FILE* (cookie will hold \p file) */
|
||||||
GMIO_LIB_EXPORT gmio_stream_t gmio_stream_stdio(FILE* file);
|
GMIO_LIB_EXPORT gmio_stream_t gmio_stream_stdio(FILE* file);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user