aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-08-15 14:58:18 +0200
committerDavid Robillard <d@drobilla.net>2020-08-15 22:52:05 +0200
commit6bd9bdffe2a06645c4a6ce84a45855fe072aeabd (patch)
treed9347101f60bf1e326b8252742b352b39baa696e /src
parent64f8675d5a18828494c53579f11ff443b41fda6e (diff)
downloadserd-6bd9bdffe2a06645c4a6ce84a45855fe072aeabd.tar.gz
serd-6bd9bdffe2a06645c4a6ce84a45855fe072aeabd.tar.bz2
serd-6bd9bdffe2a06645c4a6ce84a45855fe072aeabd.zip
Make read_PERCENT() return a status
Diffstat (limited to 'src')
-rw-r--r--src/n3.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/n3.c b/src/n3.c
index 277ef198..1b3542e7 100644
--- a/src/n3.c
+++ b/src/n3.c
@@ -481,7 +481,7 @@ read_PN_CHARS(SerdReader* reader, Ref dest)
return st;
}
-static bool
+static SerdStatus
read_PERCENT(SerdReader* reader, Ref dest)
{
push_byte(reader, dest, eat_byte_safe(reader, '%'));
@@ -489,10 +489,9 @@ read_PERCENT(SerdReader* reader, Ref dest)
const uint8_t h2 = read_HEX(reader);
if (h1 && h2) {
push_byte(reader, dest, h1);
- push_byte(reader, dest, h2);
- return true;
+ return push_byte(reader, dest, h2);
}
- return false;
+ return SERD_ERR_BAD_SYNTAX;
}
static SerdStatus
@@ -538,10 +537,7 @@ read_PLX(SerdReader* reader, Ref dest)
const int c = peek_byte(reader);
switch (c) {
case '%':
- if (!read_PERCENT(reader, dest)) {
- return SERD_ERR_BAD_SYNTAX;
- }
- return SERD_SUCCESS;
+ return read_PERCENT(reader, dest);
case '\\':
return read_PN_LOCAL_ESC(reader, dest);
default: