diff options
author | David Robillard <d@drobilla.net> | 2020-08-15 15:46:17 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-08-15 22:52:05 +0200 |
commit | 59b4ee113d45f34d7ae7b8ceca47f7416a8f1a71 (patch) | |
tree | c9578316f0aaa173164fa29619c5e2cbd0223527 /src | |
parent | 18d181f3e8bedb8f1e85d6f1b8a84110d055a3a5 (diff) | |
download | serd-59b4ee113d45f34d7ae7b8ceca47f7416a8f1a71.tar.gz serd-59b4ee113d45f34d7ae7b8ceca47f7416a8f1a71.tar.bz2 serd-59b4ee113d45f34d7ae7b8ceca47f7416a8f1a71.zip |
Make read_IRIREF_scheme() return a status
Diffstat (limited to 'src')
-rw-r--r-- | src/n3.c | 26 |
1 files changed, 11 insertions, 15 deletions
@@ -641,36 +641,32 @@ read_LANGTAG(SerdReader* reader) return ref; } -static bool +static SerdStatus read_IRIREF_scheme(SerdReader* reader, Ref dest) { int c = peek_byte(reader); if (!is_alpha(c)) { - r_err(reader, SERD_ERR_BAD_SYNTAX, "bad IRI scheme start `%c'\n", c); - return false; + return r_err(reader, SERD_ERR_BAD_SYNTAX, + "bad IRI scheme start `%c'\n", c); } while ((c = peek_byte(reader)) != EOF) { if (c == '>') { - r_err(reader, SERD_ERR_BAD_SYNTAX, "missing IRI scheme\n"); - return false; + return r_err(reader, SERD_ERR_BAD_SYNTAX, "missing IRI scheme\n"); } else if (!is_uri_scheme_char(c)) { - r_err(reader, - SERD_ERR_BAD_SYNTAX, - "bad IRI scheme char U+%04X (%c)\n", - (unsigned)c, - (char)c); - return false; + return r_err(reader, SERD_ERR_BAD_SYNTAX, + "bad IRI scheme char U+%04X (%c)\n", + (unsigned)c, + (char)c); } push_byte(reader, dest, eat_byte_safe(reader, c)); if (c == ':') { - return true; // End of scheme + return SERD_SUCCESS; // End of scheme } } - r_err(reader, SERD_ERR_BAD_SYNTAX, "unexpected end of file\n"); - return false; + return r_err(reader, SERD_ERR_BAD_SYNTAX, "unexpected end of file\n"); } static Ref @@ -679,7 +675,7 @@ read_IRIREF(SerdReader* reader) TRY_RET(eat_byte_check(reader, '<')); Ref ref = push_node(reader, SERD_URI, "", 0); SerdStatus st = SERD_SUCCESS; - if (!fancy_syntax(reader) && !read_IRIREF_scheme(reader, ref)) { + if (!fancy_syntax(reader) && read_IRIREF_scheme(reader, ref)) { return pop_node(reader, ref); } |