diff options
author | David Robillard <d@drobilla.net> | 2022-11-24 16:40:51 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-11-25 07:05:56 -0500 |
commit | d40a7fe79847ab46e544d9fbb845affbe876c0db (patch) | |
tree | ee33ce36010a31faf7915f1b1a5cfdc60d660b27 /src/reader.h | |
parent | f2ea3154a742238f0b9943bb58efd0627ffda3e8 (diff) | |
download | serd-d40a7fe79847ab46e544d9fbb845affbe876c0db.tar.gz serd-d40a7fe79847ab46e544d9fbb845affbe876c0db.tar.bz2 serd-d40a7fe79847ab46e544d9fbb845affbe876c0db.zip |
Always handle the return value of eat_byte_safe()
Diffstat (limited to 'src/reader.h')
-rw-r--r-- | src/reader.h | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/reader.h b/src/reader.h index cccaa8a9..e2f8cdb9 100644 --- a/src/reader.h +++ b/src/reader.h @@ -120,16 +120,25 @@ peek_byte(SerdReader* reader) return source->eof ? EOF : (int)source->read_buf[source->read_head]; } -static inline int +static inline SerdStatus +skip_byte(SerdReader* reader, const int byte) +{ + (void)byte; + + assert(peek_byte(reader) == byte); + + return serd_byte_source_advance(&reader->source); +} + +static inline int SERD_NODISCARD eat_byte_safe(SerdReader* reader, const int byte) { (void)byte; - const int c = peek_byte(reader); - assert(c == byte); + assert(peek_byte(reader) == byte); serd_byte_source_advance(&reader->source); - return c; + return byte; } static inline int SERD_NODISCARD |