Commit 9cff8768 by Maarten L. Hekkelman

Merge branch 'potential-performance-gain' into trunk

parents cc671b80 728abe6d
...@@ -257,7 +257,7 @@ class sac_parser ...@@ -257,7 +257,7 @@ class sac_parser
CIFToken m_lookahead; CIFToken m_lookahead;
std::string m_token_value; std::string m_token_value;
CIFValue mTokenType; CIFValue mTokenType;
std::stack<int> m_buffer; std::string m_buffer; // retract buffer, used to be a stack<char>
}; };
// -------------------------------------------------------------------- // --------------------------------------------------------------------
......
...@@ -68,8 +68,8 @@ int sac_parser::get_next_char() ...@@ -68,8 +68,8 @@ int sac_parser::get_next_char()
result = m_source.get(); result = m_source.get();
else else
{ {
result = m_buffer.top(); result = m_buffer.back();
m_buffer.pop(); m_buffer.pop_back();
} }
// very simple CR/LF translation into LF // very simple CR/LF translation into LF
...@@ -77,11 +77,11 @@ int sac_parser::get_next_char() ...@@ -77,11 +77,11 @@ int sac_parser::get_next_char()
{ {
int lookahead = m_source.get(); int lookahead = m_source.get();
if (lookahead != '\n') if (lookahead != '\n')
m_buffer.push(lookahead); m_buffer.push_back(lookahead);
result = '\n'; result = '\n';
} }
m_token_value += static_cast<char>(result); m_token_value.push_back(static_cast<char>(result));
if (result == '\n') if (result == '\n')
++m_line_nr; ++m_line_nr;
...@@ -106,7 +106,7 @@ void sac_parser::retract() ...@@ -106,7 +106,7 @@ void sac_parser::retract()
if (ch == '\n') if (ch == '\n')
--m_line_nr; --m_line_nr;
m_buffer.push(ch); m_buffer.push_back(ch);
m_token_value.pop_back(); m_token_value.pop_back();
} }
......
...@@ -1427,10 +1427,9 @@ bool Remark3Parser::parse(const std::string &expMethod, PDBRecord *r, cif::datab ...@@ -1427,10 +1427,9 @@ bool Remark3Parser::parse(const std::string &expMethod, PDBRecord *r, cif::datab
sort(scores.begin(), scores.end()); sort(scores.begin(), scores.end());
bool guessProgram = scores.empty() or scores.front().score < 0.9f; bool guessProgram = scores.empty() or scores.front().score < 0.9f;
;
if (guessProgram) if (guessProgram)
{ {
if (cif::VERBOSE >= 0) if (cif::VERBOSE > 0)
std::cerr << "Unknown or untrusted program in REMARK 3, trying all parsers to see if there is a match" << std::endl; std::cerr << "Unknown or untrusted program in REMARK 3, trying all parsers to see if there is a match" << std::endl;
tryParser(new BUSTER_TNT_Remark3Parser("BUSTER-TNT", expMethod, r, db)); tryParser(new BUSTER_TNT_Remark3Parser("BUSTER-TNT", expMethod, r, db));
......
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