From 02668e0cb0e422cbc822350e4d190ff8e6dba80b Mon Sep 17 00:00:00 2001 From: Hugues Delorme Date: Tue, 5 Jan 2016 11:48:56 +0100 Subject: [PATCH] tests: remove typedef around struct gmio_ro_buffer --- tests/stream_buffer.c | 20 +++++++++++--------- tests/stream_buffer.h | 3 +-- tests/test_core_internal.c | 6 +++--- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/tests/stream_buffer.c b/tests/stream_buffer.c index 3f5e723..184155e 100644 --- a/tests/stream_buffer.c +++ b/tests/stream_buffer.c @@ -19,13 +19,13 @@ static gmio_bool_t gmio_stream_buffer_at_end(void* cookie) { - const gmio_ro_buffer_t* buff = (const gmio_ro_buffer_t*)cookie; + const struct gmio_ro_buffer* buff = (const struct gmio_ro_buffer*)cookie; return buff->pos >= buff->len; } static int gmio_stream_buffer_error(void* cookie) { - const gmio_ro_buffer_t* buff = (const gmio_ro_buffer_t*)cookie; + const struct gmio_ro_buffer* buff = (const struct gmio_ro_buffer*)cookie; return buff == NULL || buff->pos > buff->len; } @@ -33,7 +33,7 @@ static size_t gmio_stream_buffer_read( void* cookie, void* ptr, size_t item_size, size_t item_count) { if (item_size > 0 && item_count > 0) { - gmio_ro_buffer_t* buff = (gmio_ro_buffer_t*)cookie; + struct gmio_ro_buffer* buff = (struct gmio_ro_buffer*)cookie; const void* buff_ptr = buff->ptr; const size_t buff_remaining_size = buff->len - buff->pos; const size_t wanted_read_size = item_size * item_count; @@ -80,25 +80,26 @@ static size_t gmio_stream_buffer_write( static gmio_streamsize_t gmio_stream_buffer_size(void* cookie) { - const gmio_ro_buffer_t* buff = (const gmio_ro_buffer_t*)cookie; + const struct gmio_ro_buffer* buff = (const struct gmio_ro_buffer*)cookie; return buff->len; } static int gmio_stream_buffer_get_pos(void* cookie, struct gmio_streampos* pos) { - gmio_ro_buffer_t* buff = (gmio_ro_buffer_t*)cookie; + struct gmio_ro_buffer* buff = (struct gmio_ro_buffer*)cookie; memcpy(&pos->cookie[0], &buff->pos, sizeof(size_t)); return 0; } -static int gmio_stream_buffer_set_pos(void* cookie, const struct gmio_streampos* pos) +static int gmio_stream_buffer_set_pos( + void* cookie, const struct gmio_streampos* pos) { - gmio_ro_buffer_t* buff = (gmio_ro_buffer_t*)cookie; + struct gmio_ro_buffer* buff = (struct gmio_ro_buffer*)cookie; memcpy(&buff->pos, &pos->cookie[0], sizeof(size_t)); return 0; } -struct gmio_stream gmio_istream_buffer(gmio_ro_buffer_t* buff) +struct gmio_stream gmio_istream_buffer(struct gmio_ro_buffer* buff) { struct gmio_stream stream = {0}; stream.cookie = buff; @@ -113,7 +114,8 @@ struct gmio_stream gmio_istream_buffer(gmio_ro_buffer_t* buff) struct gmio_stream gmio_stream_buffer(struct gmio_rw_buffer* buff) { - struct gmio_stream stream = gmio_istream_buffer((gmio_ro_buffer_t*)buff); + struct gmio_stream stream = + gmio_istream_buffer((struct gmio_ro_buffer*)buff); stream.func_write = gmio_stream_buffer_write; return stream; } diff --git a/tests/stream_buffer.h b/tests/stream_buffer.h index 1756419..2b57726 100644 --- a/tests/stream_buffer.h +++ b/tests/stream_buffer.h @@ -25,7 +25,6 @@ struct gmio_ro_buffer size_t len; size_t pos; }; -typedef struct gmio_ro_buffer gmio_ro_buffer_t; /* Read/write buffer */ struct gmio_rw_buffer @@ -35,7 +34,7 @@ struct gmio_rw_buffer size_t pos; }; -struct gmio_stream gmio_istream_buffer(gmio_ro_buffer_t* buff); +struct gmio_stream gmio_istream_buffer(struct gmio_ro_buffer* buff); struct gmio_stream gmio_iostream_buffer(struct gmio_rw_buffer* buff); #endif /* GMIO_STREAM_BUFFER_H */ diff --git a/tests/test_core_internal.c b/tests/test_core_internal.c index d1f419a..f63db46 100644 --- a/tests/test_core_internal.c +++ b/tests/test_core_internal.c @@ -132,7 +132,7 @@ const char* test_internal__gmio_fast_atof() { char strbuff[2048] = {0}; struct gmio_stringstream sstream = {0}; - gmio_ro_buffer_t streambuff = { fstr, sizeof(fstr) - 1, 0 }; + struct gmio_ro_buffer streambuff = { fstr, sizeof(fstr) - 1, 0 }; float f2; sstream.stream = gmio_istream_buffer(&streambuff); @@ -178,7 +178,7 @@ const char* test_internal__stringstream() "Parfois le chemin est rude.\n" "pi : 3.1415926535897932384626433832795"; { - gmio_ro_buffer_t buff = { text, sizeof(text) - 1, 0 }; + struct gmio_ro_buffer buff = { text, sizeof(text) - 1, 0 }; char small_fwd_it_str[4]; char fwd_it_str[32]; @@ -234,7 +234,7 @@ const char* test_internal__stringstream() } { - gmio_ro_buffer_t buff = { text, sizeof(text) - 1, 0 }; + struct gmio_ro_buffer buff = { text, sizeof(text) - 1, 0 }; char fwd_it_str[32]; struct gmio_stringstream fwd_it = {0};