gmio_core: micro-optimization in gmio_next_char()
This commit is contained in:
parent
4d1dd420fc
commit
f677dc8f4f
@ -42,19 +42,6 @@ const char *gmio_current_char(const gmio_string_stream_fwd_iterator_t *it)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
GMIO_INLINE gmio_bool_t gmio_is_next_char_buffered(
|
|
||||||
const gmio_string_stream_fwd_iterator_t *it)
|
|
||||||
{
|
|
||||||
return (it->buffer_pos + 1) < it->buffer.len ? GMIO_TRUE : GMIO_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
GMIO_INLINE const char* gmio_next_char_from_buffer(
|
|
||||||
gmio_string_stream_fwd_iterator_t *it)
|
|
||||||
{
|
|
||||||
++(it->buffer_pos);
|
|
||||||
return it->buffer.ptr + it->buffer_pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
GMIO_INLINE const char* gmio_next_char_from_stream(
|
GMIO_INLINE const char* gmio_next_char_from_stream(
|
||||||
gmio_string_stream_fwd_iterator_t *it)
|
gmio_string_stream_fwd_iterator_t *it)
|
||||||
{
|
{
|
||||||
@ -73,8 +60,9 @@ GMIO_INLINE const char* gmio_next_char_from_stream(
|
|||||||
|
|
||||||
const char *gmio_next_char(gmio_string_stream_fwd_iterator_t *it)
|
const char *gmio_next_char(gmio_string_stream_fwd_iterator_t *it)
|
||||||
{
|
{
|
||||||
if (gmio_is_next_char_buffered(it) == GMIO_TRUE)
|
++(it->buffer_pos);
|
||||||
return gmio_next_char_from_buffer(it);
|
if (it->buffer_pos < it->buffer.len)
|
||||||
|
return it->buffer.ptr + it->buffer_pos;
|
||||||
return gmio_next_char_from_stream(it);
|
return gmio_next_char_from_stream(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user