Use substr() instead of assignment plus erase()

This commit is contained in:
Dmitry-Me 2016-01-15 14:22:08 +03:00
parent 930e7f7004
commit 7bf88fbb09
1 changed files with 3 additions and 3 deletions

View File

@ -2761,10 +2761,10 @@ public:
if (tok->strAt(-1) != "##") {
const std::map<std::string, PreprocessorMacro *>::const_iterator it = macros.find(str);
if (it != macros.end() && it->second->_macro.find('(') == std::string::npos) {
str = it->second->_macro;
const std::string::size_type whitespacePos = str.find(' ');
const std::string& macro = it->second->_macro;
const std::string::size_type whitespacePos = macro.find(' ');
if (whitespacePos != std::string::npos)
str.erase(0, whitespacePos);
str = macro.substr(whitespacePos);
else
str = "";
}