performance enhancement (patch submitted by davidmiller in ticket 231)

This commit is contained in:
Daniel Marjamäki 2009-03-28 20:33:55 +01:00
parent ad7df1cbe0
commit 447c830e8f
3 changed files with 9 additions and 4 deletions

View File

@ -58,6 +58,12 @@ void Token::str(const char s[])
_varId = 0;
}
void Token::concatStr(std::string const& b)
{
_str.erase(_str.length() - 1);
_str.append(b.begin() + 1, b.end());
}
void Token::deleteNext()
{
Token *n = _next;

View File

@ -29,6 +29,8 @@ public:
~Token();
void str(const char s[]);
void concatStr(std::string const& b);
const std::string &str() const
{
return _str;

View File

@ -811,10 +811,7 @@ void Tokenizer::simplifyTokenList()
while (tok->str()[0] == '"' && tok->next() && tok->next()->str()[0] == '"')
{
// Two strings after each other, combine them
std::string temp = tok->str();
temp.erase(temp.length() - 1);
temp.append(tok->next()->str().substr(1));
tok->str(temp.c_str());
tok->concatStr(tok->next()->str());
tok->deleteNext();
}
}