diff options
author | David Robillard <d@drobilla.net> | 2019-03-10 13:06:33 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2021-03-08 23:23:05 -0500 |
commit | aa76de1ebf17be90d37cfc471957a565165b29dc (patch) | |
tree | eb99aa86d2a7912d7fc0cef95a242b6b52d02212 /src/writer.c | |
parent | ab0403066f8bf49754f0afa94f5910ca690bc5aa (diff) | |
download | serd-aa76de1ebf17be90d37cfc471957a565165b29dc.tar.gz serd-aa76de1ebf17be90d37cfc471957a565165b29dc.tar.bz2 serd-aa76de1ebf17be90d37cfc471957a565165b29dc.zip |
Factor out writing top level separator
Diffstat (limited to 'src/writer.c')
-rw-r--r-- | src/writer.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/writer.c b/src/writer.c index 38a64459..2e4bcb6c 100644 --- a/src/writer.c +++ b/src/writer.c @@ -488,6 +488,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) { @@ -881,10 +889,7 @@ serd_writer_write_statement(SerdWriter* 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) { @@ -934,9 +939,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)) { |