Use substr() instead of assignment plus erase()
This commit is contained in:
parent
930e7f7004
commit
7bf88fbb09
|
@ -2761,10 +2761,10 @@ public:
|
||||||
if (tok->strAt(-1) != "##") {
|
if (tok->strAt(-1) != "##") {
|
||||||
const std::map<std::string, PreprocessorMacro *>::const_iterator it = macros.find(str);
|
const std::map<std::string, PreprocessorMacro *>::const_iterator it = macros.find(str);
|
||||||
if (it != macros.end() && it->second->_macro.find('(') == std::string::npos) {
|
if (it != macros.end() && it->second->_macro.find('(') == std::string::npos) {
|
||||||
str = it->second->_macro;
|
const std::string& macro = it->second->_macro;
|
||||||
const std::string::size_type whitespacePos = str.find(' ');
|
const std::string::size_type whitespacePos = macro.find(' ');
|
||||||
if (whitespacePos != std::string::npos)
|
if (whitespacePos != std::string::npos)
|
||||||
str.erase(0, whitespacePos);
|
str = macro.substr(whitespacePos);
|
||||||
else
|
else
|
||||||
str = "";
|
str = "";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue