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) static std::string invertOperatorForOperandSwap(std::string s)
{ {
for (std::string::size_type i = 0; i < s.length(); i++) { if (s[0] == '<')
if (s[i] == '>') s[0] = '>';
s[i] = '<'; else if (s[0] == '>')
else if (s[i] == '<') s[0] = '<';
s[i] = '>';
}
return s; return s;
} }