aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-11-24 15:13:40 -0500
committerDavid Robillard <d@drobilla.net>2022-11-24 15:53:05 -0500
commit2a7fc07c2371c2bbfba74d2a97c0467f9f89a87d (patch)
tree600a0829fd7ca62e6776379b8296e22c2fb4308e
parent1f2ac0050a87bab21ad2fa8c2e09cd2d2da1eb8b (diff)
downloadserd-2a7fc07c2371c2bbfba74d2a97c0467f9f89a87d.tar.gz
serd-2a7fc07c2371c2bbfba74d2a97c0467f9f89a87d.tar.bz2
serd-2a7fc07c2371c2bbfba74d2a97c0467f9f89a87d.zip
Simplify error handling logic
-rw-r--r--src/n3.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/n3.c b/src/n3.c
index cd6b6de6..f1d04206 100644
--- a/src/n3.c
+++ b/src/n3.c
@@ -384,7 +384,7 @@ read_STRING_LITERAL(SerdReader* const reader,
{
SerdStatus st = SERD_SUCCESS;
- while (!(st && reader->strict)) {
+ while (!st || !reader->strict) {
const int c = peek_byte(reader);
uint32_t code = 0;
switch (c) {
@@ -405,15 +405,14 @@ read_STRING_LITERAL(SerdReader* const reader,
if (c == q) {
eat_byte_check(reader, q);
return SERD_SUCCESS;
- } else {
- st =
- read_character(reader, ref, flags, (uint8_t)eat_byte_safe(reader, c));
}
+
+ st =
+ read_character(reader, ref, flags, (uint8_t)eat_byte_safe(reader, c));
}
}
- return st ? st
- : (eat_byte_check(reader, q) ? SERD_SUCCESS : SERD_ERR_BAD_SYNTAX);
+ return eat_byte_check(reader, q) ? SERD_SUCCESS : SERD_ERR_BAD_SYNTAX;
}
static SerdStatus