aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-03-10 13:06:33 +0100
committerDavid Robillard <d@drobilla.net>2019-04-13 19:48:23 +0200
commitc8e1af98cab4726124a0c9ee7afbbe63fc8fc6f9 (patch)
tree78b3f2b39cb9f18e5bf9b3b3bbae6ce2956bbe0e
parent5cd753ba82535641b6dccb0064110f1bc8e22804 (diff)
downloadserd-c8e1af98cab4726124a0c9ee7afbbe63fc8fc6f9.tar.gz
serd-c8e1af98cab4726124a0c9ee7afbbe63fc8fc6f9.tar.bz2
serd-c8e1af98cab4726124a0c9ee7afbbe63fc8fc6f9.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 62dcc3b3..46d485c3 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -388,6 +388,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)
{
@@ -753,9 +761,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) {
@@ -793,9 +799,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)) {