code cleanup for invertOperatorForOperandSwap()

This commit is contained in:
Daniel Marjamäki 2014-04-03 16:22:07 +02:00
parent ffac614f7e
commit 110f956029
1 changed files with 4 additions and 6 deletions

View File

@ -1253,12 +1253,10 @@ void CheckOther::selfAssignmentError(const Token *tok, const std::string &varnam
static std::string invertOperatorForOperandSwap(std::string s)
{
for (std::string::size_type i = 0; i < s.length(); i++) {
if (s[i] == '>')
s[i] = '<';
else if (s[i] == '<')
s[i] = '>';
}
if (s[0] == '<')
s[0] = '>';
else if (s[0] == '>')
s[0] = '<';
return s;
}