aboutsummaryrefslogtreecommitdiffstats
path: root/src/byte_source.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-07-22 16:57:46 +0200
committerDavid Robillard <d@drobilla.net>2018-07-22 16:57:46 +0200
commit8b8890dd104066c190497792e427ad2a9a7f918a (patch)
tree26b553712fcb6fca01fc1199f97cd7e189a31488 /src/byte_source.c
parentade6c7579fae302d64681555a77dbf78fcacd682 (diff)
downloadserd-8b8890dd104066c190497792e427ad2a9a7f918a.tar.gz
serd-8b8890dd104066c190497792e427ad2a9a7f918a.tar.bz2
serd-8b8890dd104066c190497792e427ad2a9a7f918a.zip
Inline serd_byte_source_advance
Diffstat (limited to 'src/byte_source.c')
-rw-r--r--src/byte_source.c35
1 files changed, 1 insertions, 34 deletions
diff --git a/src/byte_source.c b/src/byte_source.c
index 1b02c2be..1a67157b 100644
--- a/src/byte_source.c
+++ b/src/byte_source.c
@@ -16,7 +16,7 @@
#include "serd_internal.h"
-static inline SerdStatus
+SerdStatus
serd_byte_source_page(SerdByteSource* source)
{
source->read_head = 0;
@@ -96,36 +96,3 @@ serd_byte_source_close(SerdByteSource* source)
memset(source, '\0', sizeof(*source));
return SERD_SUCCESS;
}
-
-SerdStatus
-serd_byte_source_advance(SerdByteSource* source)
-{
- const bool paging = source->page_size > 1;
- SerdStatus st = SERD_SUCCESS;
-
- switch (serd_byte_source_peek(source)) {
- case '\0': break;
- case '\n': ++source->cur.line; source->cur.col = 0; break;
- default: ++source->cur.col;
- }
-
- // Reset EOF marker for reading from sockets/pipes
- source->eof = source->eof && !source->from_stream;
-
- if (source->from_stream && paging) {
- if (++source->read_head == source->page_size) {
- st = serd_byte_source_page(source);
- }
- } else if (source->from_stream) {
- if (!source->read_func(&source->read_byte, 1, 1, source->stream)) {
- st = source->error_func(source->stream) ? SERD_ERR_UNKNOWN
- : SERD_FAILURE;
- }
- } else if (source->eof) {
- st = SERD_FAILURE; // Can't read past end of string
- } else {
- ++source->read_head; // Move to next character in string
- }
-
- return st;
-}