diff options
author | David Robillard <d@drobilla.net> | 2022-12-09 10:05:19 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-12-09 10:05:19 -0500 |
commit | 221636904b9389a3709c40c38ca3dbf51e4c32f7 (patch) | |
tree | 3227a9e14cb71d9e1fb5e88a6a167f149f662165 /src | |
parent | 9a222ac2ae6b4dac6dd8a414498523f472e90279 (diff) | |
download | serd-221636904b9389a3709c40c38ca3dbf51e4c32f7.tar.gz serd-221636904b9389a3709c40c38ca3dbf51e4c32f7.tar.bz2 serd-221636904b9389a3709c40c38ca3dbf51e4c32f7.zip |
Add serd_reader_skip_until_byte() to public API
Diffstat (limited to 'src')
-rw-r--r-- | src/n3.c | 13 | ||||
-rw-r--r-- | src/serd_config.h | 2 |
2 files changed, 10 insertions, 5 deletions
@@ -1672,12 +1672,17 @@ read_n3_statement(SerdReader* const reader) return st; } -static void -skip_until(SerdReader* const reader, const uint8_t byte) +SerdStatus +serd_reader_skip_until_byte(SerdReader* const reader, const uint8_t byte) { - for (int c = 0; (c = peek_byte(reader)) && c != byte && c != EOF;) { + int c = peek_byte(reader); + + while (c != byte && c != EOF) { skip_byte(reader, c); + c = peek_byte(reader); } + + return c == EOF ? SERD_FAILURE : SERD_SUCCESS; } SerdStatus @@ -1689,7 +1694,7 @@ read_turtleTrigDoc(SerdReader* const reader) if (reader->strict) { return st; } - skip_until(reader, '\n'); + serd_reader_skip_until_byte(reader, '\n'); } } diff --git a/src/serd_config.h b/src/serd_config.h index 98fb01c9..df73522b 100644 --- a/src/serd_config.h +++ b/src/serd_config.h @@ -16,7 +16,7 @@ #define SERD_CONFIG_H // Define version unconditionally so a warning will catch a mismatch -#define SERD_VERSION "0.30.17" +#define SERD_VERSION "0.31.0" #if !defined(SERD_NO_DEFAULT_CONFIG) |