diff options
-rw-r--r-- | NEWS | 5 | ||||
-rw-r--r-- | doc/serdi.1 | 2 | ||||
-rw-r--r-- | include/serd/serd.h | 13 | ||||
-rw-r--r-- | meson.build | 2 | ||||
-rw-r--r-- | src/n3.c | 13 | ||||
-rw-r--r-- | src/serd_config.h | 2 |
6 files changed, 28 insertions, 9 deletions
@@ -1,6 +1,7 @@ -serd (0.30.17) unstable; urgency=medium +serd (0.31.0) unstable; urgency=medium * Add Windows path separator support to serd_node_new_file_uri() + * Add serd_reader_skip_until_byte() to public API * Fix crash when trying to read chunks without starting * Fix hang when skipping an error at EOF when lax parsing * Gracefully handle bad characters in Turtle blank node syntax @@ -10,7 +11,7 @@ serd (0.30.17) unstable; urgency=medium * Replace duplicated dox_to_sphinx script with sphinxygen dependency * Test header for warnings more strictly - -- David Robillard <d@drobilla.net> Sun, 04 Dec 2022 18:33:52 +0000 + -- David Robillard <d@drobilla.net> Fri, 09 Dec 2022 14:53:37 +0000 serd (0.30.16) stable; urgency=medium diff --git a/doc/serdi.1 b/doc/serdi.1 index 48b1a5d4..997676a0 100644 --- a/doc/serdi.1 +++ b/doc/serdi.1 @@ -2,7 +2,7 @@ .\" # SPDX-License-Identifier: ISC .Dd Jul 15, 2022 .Dt SERDI 1 -.Os Serd 0.30.17 +.Os Serd 0.31.0 .Sh NAME .Nm serdi .Nd read and write RDF syntax diff --git a/include/serd/serd.h b/include/serd/serd.h index cf6b5e4d..42e85f87 100644 --- a/include/serd/serd.h +++ b/include/serd/serd.h @@ -856,6 +856,19 @@ SerdStatus serd_reader_read_string(SerdReader* SERD_NONNULL reader, const uint8_t* SERD_NONNULL utf8); +/** + Skip over bytes in the input until a specific byte is encountered. + + Typically used for recording from errors in a line-based syntax by skipping + ahead to the next newline. + + @return #SERD_SUCCESS if the given byte was reached, or #SERD_FAILURE if the + end of input is reached. +*/ +SERD_API +SerdStatus +serd_reader_skip_until_byte(SerdReader* SERD_NONNULL reader, uint8_t byte); + /// Free `reader` SERD_API void diff --git a/meson.build b/meson.build index 8c3db730..b569c460 100644 --- a/meson.build +++ b/meson.build @@ -2,7 +2,7 @@ # SPDX-License-Identifier: 0BSD OR ISC project('serd', ['c'], - version: '0.30.17', + version: '0.31.0', license: 'ISC', meson_version: '>= 0.56.0', default_options: [ @@ -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) |