aboutsummaryrefslogtreecommitdiffstats
path: root/src/reader.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-09-30 12:11:54 +0200
committerDavid Robillard <d@drobilla.net>2020-10-28 10:08:37 +0100
commitd65769b7b9ad6a8c9c75f8fd96f929f8a2938774 (patch)
treebfb8bb551e5b31abe20e0e0a2b2f3fc720bb1951 /src/reader.h
parent57df93db4ea32a3885259ac9346e899db8103da9 (diff)
downloadserd-d65769b7b9ad6a8c9c75f8fd96f929f8a2938774.tar.gz
serd-d65769b7b9ad6a8c9c75f8fd96f929f8a2938774.tar.bz2
serd-d65769b7b9ad6a8c9c75f8fd96f929f8a2938774.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.
Diffstat (limited to 'src/reader.h')
-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;
}