diff options
author | David Robillard <d@drobilla.net> | 2019-03-10 13:06:33 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-01-13 23:04:06 -0500 |
commit | 20fc410ace9616df9b7d8444d747aaa700f4f6c8 (patch) | |
tree | a3e6755ae27a026d8fad9f64e92559a2fb06bf14 /src | |
parent | 89be71eabefcc55a3d0a56d7bed7124c4fdafbd8 (diff) | |
download | serd-20fc410ace9616df9b7d8444d747aaa700f4f6c8.tar.gz serd-20fc410ace9616df9b7d8444d747aaa700f4f6c8.tar.bz2 serd-20fc410ace9616df9b7d8444d747aaa700f4f6c8.zip |
Factor out writing top level separator
Diffstat (limited to 'src')
-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 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)) { |