From 20fc410ace9616df9b7d8444d747aaa700f4f6c8 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 10 Mar 2019 13:06:33 +0100 Subject: Factor out writing top level separator --- src/writer.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/writer.c b/src/writer.c index 27960f1e..b682f6a8 100644 --- a/src/writer.c +++ b/src/writer.c @@ -480,6 +480,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) { @@ -853,10 +861,7 @@ serd_writer_write_statement(SerdWriter* const writer, 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) { @@ -906,9 +911,7 @@ serd_writer_write_statement(SerdWriter* const 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)) { -- cgit v1.2.1