diff options
author | David Robillard <d@drobilla.net> | 2019-03-10 13:06:33 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-10-27 13:13:58 +0100 |
commit | e5c5190771faec5bf3a81941d174763c2fda2a98 (patch) | |
tree | 9500fbcc2a6c20dd56cfdcdddd0d086c6ab1842f | |
parent | 2504ed048f9e5006bf6845ade3d83771a4885a78 (diff) | |
download | serd-e5c5190771faec5bf3a81941d174763c2fda2a98.tar.gz serd-e5c5190771faec5bf3a81941d174763c2fda2a98.tar.bz2 serd-e5c5190771faec5bf3a81941d174763c2fda2a98.zip |
Factor out writing top level separator
-rw-r--r-- | src/writer.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/writer.c b/src/writer.c index 7a27aa47..a0206578 100644 --- a/src/writer.c +++ b/src/writer.c @@ -419,6 +419,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) { @@ -779,9 +787,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) { @@ -831,9 +837,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)) { |