aboutsummaryrefslogtreecommitdiffstats
path: root/src/writer.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2024-06-24 15:01:11 -0400
committerDavid Robillard <d@drobilla.net>2024-06-25 15:54:43 -0400
commit47f30703ee6935de393303b7a4d6bab8ce7780f4 (patch)
tree3f0a8ed8c40bb2970962c5f3c62e17f654d59263 /src/writer.c
parent032abfdff61056a7029a440fc1895bbe41ec964a (diff)
downloadserd-47f30703ee6935de393303b7a4d6bab8ce7780f4.tar.gz
serd-47f30703ee6935de393303b7a4d6bab8ce7780f4.tar.bz2
serd-47f30703ee6935de393303b7a4d6bab8ce7780f4.zip
Replace questionable switch statements with shorter conditionals
Diffstat (limited to 'src/writer.c')
-rw-r--r--src/writer.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/src/writer.c b/src/writer.c
index c0f1a4a7..1d3eed4d 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -859,20 +859,12 @@ write_node(SerdWriter* writer,
Field field,
SerdStatementFlags flags)
{
- switch (node->type) {
- case SERD_NOTHING:
- break;
- case SERD_LITERAL:
- return write_literal(writer, node, datatype, lang, flags);
- case SERD_URI:
- return write_uri_node(writer, node, field);
- case SERD_CURIE:
- return write_curie(writer, node);
- case SERD_BLANK:
- return write_blank(writer, node, field, flags);
- }
-
- return SERD_SUCCESS;
+ return (node->type == SERD_LITERAL)
+ ? write_literal(writer, node, datatype, lang, flags)
+ : (node->type == SERD_URI) ? write_uri_node(writer, node, field)
+ : (node->type == SERD_CURIE) ? write_curie(writer, node)
+ : (node->type == SERD_BLANK) ? write_blank(writer, node, field, flags)
+ : SERD_SUCCESS;
}
static bool