Commit d6aeb164 authored by Jesse Beder's avatar Jesse Beder
Browse files

Switched the scanner list of owned indent markers to a ptr_vector

parent a518d87c
......@@ -14,9 +14,6 @@ namespace YAML
Scanner::~Scanner()
{
for(unsigned i=0;i<m_indentRefs.size();i++)
delete m_indentRefs[i];
m_indentRefs.clear();
}
// empty
......@@ -237,9 +234,9 @@ namespace YAML
{
m_startedStream = true;
m_simpleKeyAllowed = true;
IndentMarker *pIndent = new IndentMarker(-1, IndentMarker::NONE);
std::auto_ptr<IndentMarker> 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
......
......@@ -12,6 +12,7 @@
#include <stack>
#include <set>
#include <map>
#include "ptr_vector.h"
#include "stream.h"
#include "token.h"
......@@ -114,16 +115,16 @@ namespace YAML
Stream INPUT;
// the output (tokens)
std::queue <Token> m_tokens;
std::queue<Token> m_tokens;
// state info
bool m_startedStream, m_endedStream;
bool m_simpleKeyAllowed;
bool m_canBeJSONFlow;
std::stack <SimpleKey> m_simpleKeys;
std::stack <IndentMarker *> m_indents;
std::vector <IndentMarker *> m_indentRefs; // for "garbage collection"
std::stack <FLOW_MARKER> m_flows;
std::stack<SimpleKey> m_simpleKeys;
std::stack<IndentMarker *> m_indents;
ptr_vector<IndentMarker> m_indentRefs; // for "garbage collection"
std::stack<FLOW_MARKER> m_flows;
};
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment