performance enhancement (patch submitted by davidmiller in ticket 231)
This commit is contained in:
parent
ad7df1cbe0
commit
447c830e8f
|
@ -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;
|
||||
|
|
|
@ -29,6 +29,8 @@ public:
|
|||
~Token();
|
||||
void str(const char s[]);
|
||||
|
||||
void concatStr(std::string const& b);
|
||||
|
||||
const std::string &str() const
|
||||
{
|
||||
return _str;
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue