From 1b8b7f681987086a27866220dd5f0ecefd6aab2c Mon Sep 17 00:00:00 2001 From: Luke Street Date: Wed, 10 Jun 2020 00:13:49 -0400 Subject: [PATCH] DNAYaml: Correctly initialize yaml events --- src/athena/DNAYaml.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/athena/DNAYaml.cpp b/src/athena/DNAYaml.cpp index fd3c4f3..e8ac58f 100644 --- a/src/athena/DNAYaml.cpp +++ b/src/athena/DNAYaml.cpp @@ -441,8 +441,6 @@ bool YAMLDocWriter::finish(athena::io::IStreamWriter* fout) { return false; }; - yaml_event_t event = {}; - if (fout) { yaml_emitter_set_output(&m_emitter, (yaml_write_handler_t*)YAMLAthenaWriter, fout); } @@ -450,16 +448,15 @@ bool YAMLDocWriter::finish(athena::io::IStreamWriter* fout) { return error(); } - event.type = YAML_DOCUMENT_START_EVENT; - event.data.document_start.implicit = true; + yaml_event_t event; + yaml_document_start_event_initialize(&event, nullptr, nullptr, nullptr, 1); if (!yaml_emitter_emit(&m_emitter, &event)) { return error(); } if (!RecursiveFinish(&m_emitter, *m_rootNode)) { return false; } - event.type = YAML_DOCUMENT_END_EVENT; - event.data.document_end.implicit = true; + yaml_document_end_event_initialize(&event, 1); if (!yaml_emitter_emit(&m_emitter, &event)) { return error(); }