aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-09-30 12:11:54 +0200
committerDavid Robillard <d@drobilla.net>2020-10-27 13:13:58 +0100
commite22520d716f5e9c32457ae7f4aa59378fd55f62c (patch)
treebfb8bb551e5b31abe20e0e0a2b2f3fc720bb1951
parent57df93db4ea32a3885259ac9346e899db8103da9 (diff)
downloadserd-e22520d716f5e9c32457ae7f4aa59378fd55f62c.tar.gz
serd-e22520d716f5e9c32457ae7f4aa59378fd55f62c.tar.bz2
serd-e22520d716f5e9c32457ae7f4aa59378fd55f62c.zip
Simplify reader byte reading interface
This eliminates eat_byte() and the way it conflates the status of advancing the source with the current character, which can cause problems with custom sinks.
-rw-r--r--src/reader.h13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/reader.h b/src/reader.h
index 69e632e8..9de37f4c 100644
--- a/src/reader.h
+++ b/src/reader.h
@@ -122,21 +122,14 @@ peek_byte(SerdReader* reader)
}
static inline int
-eat_byte(SerdReader* reader)
-{
- const int c = peek_byte(reader);
- const SerdStatus st = serd_byte_source_advance(&reader->source);
-
- return st > SERD_FAILURE ? EOF : c;
-}
-
-static inline int
eat_byte_safe(SerdReader* reader, const int byte)
{
(void)byte;
- const int c = eat_byte(reader);
+ const int c = peek_byte(reader);
assert(c == byte);
+
+ serd_byte_source_advance(&reader->source);
return c;
}