aboutsummaryrefslogtreecommitdiffstats
path: root/src/writer.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2024-06-24 15:03:42 -0400
committerDavid Robillard <d@drobilla.net>2024-06-25 15:54:43 -0400
commit72ab488af39cd487a5cefc862e3e2d3466facff3 (patch)
treeabc7cffe63594828e64d40de25219af8ea8b5e92 /src/writer.c
parent47f30703ee6935de393303b7a4d6bab8ce7780f4 (diff)
downloadserd-72ab488af39cd487a5cefc862e3e2d3466facff3.tar.gz
serd-72ab488af39cd487a5cefc862e3e2d3466facff3.tar.bz2
serd-72ab488af39cd487a5cefc862e3e2d3466facff3.zip
Clean up redundant and/or inconsistent conditionals
Diffstat (limited to 'src/writer.c')
-rw-r--r--src/writer.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/writer.c b/src/writer.c
index 1d3eed4d..bea1efcd 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -148,12 +148,6 @@ supports_abbrev(const SerdWriter* writer)
return writer->syntax == SERD_TURTLE || writer->syntax == SERD_TRIG;
}
-SERD_NODISCARD static bool
-supports_uriref(const SerdWriter* writer)
-{
- return writer->syntax == SERD_TURTLE || writer->syntax == SERD_TRIG;
-}
-
static SerdStatus
free_context(WriteContext* const ctx)
{
@@ -746,7 +740,8 @@ write_uri_node(SerdWriter* const writer,
}
}
- if (!has_scheme && !supports_uriref(writer) &&
+ if (!has_scheme &&
+ (writer->syntax == SERD_NTRIPLES || writer->syntax == SERD_NQUADS) &&
!serd_env_get_base_uri(writer->env, NULL)->buf) {
return w_err(writer,
SERD_ERR_BAD_ARG,
@@ -870,7 +865,7 @@ write_node(SerdWriter* writer,
static bool
is_resource(const SerdNode* node)
{
- return node && node->buf && node->type > SERD_LITERAL;
+ return node->buf && node->type > SERD_LITERAL;
}
SERD_NODISCARD static SerdStatus
@@ -944,8 +939,7 @@ serd_writer_write_statement(SerdWriter* writer,
SerdStatus st = SERD_SUCCESS;
- if (!is_resource(subject) || !is_resource(predicate) || !object ||
- !object->buf) {
+ if (!is_resource(subject) || !is_resource(predicate) || !object->buf) {
return SERD_ERR_BAD_ARG;
}