diff --git a/src/scanner.cpp b/src/scanner.cpp index da89ac1..199ef25 100644 --- a/src/scanner.cpp +++ b/src/scanner.cpp @@ -14,9 +14,6 @@ namespace YAML Scanner::~Scanner() { - for(unsigned i=0;i pIndent(new IndentMarker(-1, IndentMarker::NONE)); m_indentRefs.push_back(pIndent); - m_indents.push(pIndent); + m_indents.push(&m_indentRefs.back()); } // EndStream @@ -299,8 +296,8 @@ namespace YAML // and then the indent m_indents.push(&indent); - m_indentRefs.push_back(pIndent.release()); - return m_indentRefs.back(); + m_indentRefs.push_back(pIndent); + return &m_indentRefs.back(); } // PopIndentToHere diff --git a/src/scanner.h b/src/scanner.h index f76c172..59857ed 100644 --- a/src/scanner.h +++ b/src/scanner.h @@ -12,6 +12,7 @@ #include #include #include +#include "ptr_vector.h" #include "stream.h" #include "token.h" @@ -114,16 +115,16 @@ namespace YAML Stream INPUT; // the output (tokens) - std::queue m_tokens; + std::queue m_tokens; // state info bool m_startedStream, m_endedStream; bool m_simpleKeyAllowed; bool m_canBeJSONFlow; - std::stack m_simpleKeys; - std::stack m_indents; - std::vector m_indentRefs; // for "garbage collection" - std::stack m_flows; + std::stack m_simpleKeys; + std::stack m_indents; + ptr_vector m_indentRefs; // for "garbage collection" + std::stack m_flows; }; }