aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-03-10 13:06:33 +0100
committerDavid Robillard <d@drobilla.net>2019-12-20 10:26:55 -0500
commit63e3e77dd4f17df469c20d2983b69ec6910aba69 (patch)
tree3c9dcab35d4b12a88398a8a69b6ee60d144a89da
parentedcf7582cdbbf61bfd01ca6359be563b2ebd3a26 (diff)
downloadserd-63e3e77dd4f17df469c20d2983b69ec6910aba69.tar.gz
serd-63e3e77dd4f17df469c20d2983b69ec6910aba69.tar.bz2
serd-63e3e77dd4f17df469c20d2983b69ec6910aba69.zip
Factor out writing top level separator
-rw-r--r--src/writer.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/writer.c b/src/writer.c
index 849e623a..9c3b5d3e 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -385,6 +385,14 @@ write_newline(SerdWriter* writer)
}
}
+static void
+write_top_level_sep(SerdWriter* writer)
+{
+ if (!writer->empty) {
+ write_newline(writer);
+ }
+}
+
static bool
write_sep(SerdWriter* writer, const Sep sep)
{
@@ -749,9 +757,7 @@ serd_writer_write_statement(SerdWriter* writer,
if (ctx(writer, SERD_GRAPH)) {
write_sep(writer, SEP_GRAPH_END);
}
- if (!writer->empty) {
- write_newline(writer); // Blank line between top level items
- }
+ write_top_level_sep(writer);
reset_context(writer, true);
if (graph) {
@@ -789,9 +795,7 @@ serd_writer_write_statement(SerdWriter* writer,
if (ctx(writer, SERD_SUBJECT)) {
write_sep(writer, SEP_END_S); // Terminate last subject
}
- if (!writer->empty) {
- write_newline(writer); // Blank line between top level items
- }
+ write_top_level_sep(writer);
}
if (serd_stack_is_empty(&writer->anon_stack)) {