Revert "Refactoring endsWith utility function"
This reverts commit d300d1f61b
.
This commit is contained in:
parent
f27baf0956
commit
58c91c4645
|
@ -276,8 +276,8 @@ void CheckString::checkIncorrectStringCompare()
|
|||
for (const Scope * scope : symbolDatabase->functionScopes) {
|
||||
for (const Token* tok = scope->bodyStart->next(); tok != scope->bodyEnd; tok = tok->next()) {
|
||||
// skip "assert(str && ..)" and "assert(.. && str)"
|
||||
if (Token::Match(tok, "%name% (") &&
|
||||
(endsWith(tok->str(), "assert") || endsWith(tok->str(), "ASSERT")) &&
|
||||
if ((endsWith(tok->str(), "assert", 6) || endsWith(tok->str(), "ASSERT", 6)) &&
|
||||
Token::Match(tok, "%name% (") &&
|
||||
(Token::Match(tok->tokAt(2), "%str% &&") || Token::Match(tok->next()->link()->tokAt(-2), "&& %str% )")))
|
||||
tok = tok->next()->link();
|
||||
|
||||
|
|
|
@ -31,9 +31,9 @@ inline bool endsWith(const std::string &str, char c)
|
|||
return str[str.size()-1U] == c;
|
||||
}
|
||||
|
||||
inline bool endsWith(const std::string &str, const std::string &end)
|
||||
inline bool endsWith(const std::string &str, const char end[], std::size_t endlen)
|
||||
{
|
||||
return (str.size() >= end.size()) && (str.compare(str.size()-end.size(), end.size(), end)==0);
|
||||
return (str.size() >= endlen) && (str.compare(str.size()-endlen, endlen, end)==0);
|
||||
}
|
||||
|
||||
inline static const char *getOrdinalText(int i)
|
||||
|
|
Loading…
Reference in New Issue