aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-08-15 15:46:17 +0200
committerDavid Robillard <d@drobilla.net>2020-08-15 22:52:05 +0200
commit59b4ee113d45f34d7ae7b8ceca47f7416a8f1a71 (patch)
treec9578316f0aaa173164fa29619c5e2cbd0223527 /src
parent18d181f3e8bedb8f1e85d6f1b8a84110d055a3a5 (diff)
downloadserd-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.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/src/n3.c b/src/n3.c
index 3579f62a..934bd30e 100644
--- a/src/n3.c
+++ b/src/n3.c
@@ -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);
}