Refactorization: Removed whitespaces at the end of a token

Removed a redundant 'void'
This commit is contained in:
Philipp Kloke 2014-04-12 23:28:13 +02:00
parent ddf34440b6
commit dfd9d32c4b
4 changed files with 8 additions and 8 deletions

View File

@ -577,7 +577,7 @@ void CheckClass::initializeVarList(const Function &func, std::list<const Functio
ftok = ftok->tokAt(2);
// Skip "classname :: "
if (Token::Match(ftok, ":: %var% "))
if (Token::Match(ftok, ":: %var%"))
ftok = ftok->next();
while (Token::Match(ftok, "%var% ::"))
ftok = ftok->tokAt(2);

View File

@ -2566,7 +2566,7 @@ void CheckOther::checkInvalidFree()
// If a previously-allocated pointer is assigned a completely new value,
// we can't know if any subsequent free() on that pointer is valid or not.
else if (Token::Match(tok, "%var% = ")) {
else if (Token::Match(tok, "%var% =")) {
allocatedVariables.erase(tok->varId());
}
@ -2819,18 +2819,18 @@ void CheckOther::checkAlwaysTrueOrFalseStringCompare()
for (const Token* tok = _tokenizer->tokens(); tok; tok = tok->next()) {
if (Token::Match(tok, "strncmp|strcmp|stricmp|strcmpi|strcasecmp|wcscmp|wcsncmp (")) {
if (Token::Match(tok->tokAt(2), "%str% , %str% ")) {
if (Token::Match(tok->tokAt(2), "%str% , %str%")) {
const std::string &str1 = tok->strAt(2);
const std::string &str2 = tok->strAt(4);
alwaysTrueFalseStringCompareError(tok, str1, str2);
tok = tok->tokAt(5);
} else if (Token::Match(tok->tokAt(2), "%var% , %var% ")) {
} else if (Token::Match(tok->tokAt(2), "%var% , %var%")) {
const std::string &str1 = tok->strAt(2);
const std::string &str2 = tok->strAt(4);
if (str1 == str2)
alwaysTrueStringVariableCompareError(tok, str1, str2);
tok = tok->tokAt(5);
} else if (Token::Match(tok->tokAt(2), "%var% . c_str ( ) , %var% . c_str ( ) ")) {
} else if (Token::Match(tok->tokAt(2), "%var% . c_str ( ) , %var% . c_str ( )")) {
const std::string &str1 = tok->strAt(2);
const std::string &str2 = tok->strAt(8);
if (str1 == str2)
@ -2923,7 +2923,7 @@ void CheckOther::suspiciousStringCompareError(const Token* tok, const std::strin
// Reference:
// - http://www.cplusplus.com/reference/cmath/
//-----------------------------------------------------------------------------
void CheckOther::checkComparisonFunctionIsAlwaysTrueOrFalse(void)
void CheckOther::checkComparisonFunctionIsAlwaysTrueOrFalse()
{
if (!_settings->isEnabled("warning"))
return;

View File

@ -266,7 +266,7 @@ public:
void checkCastIntToCharAndBack();
/** @brief %Check for using of comparison functions evaluating always to true or false. */
void checkComparisonFunctionIsAlwaysTrueOrFalse(void);
void checkComparisonFunctionIsAlwaysTrueOrFalse();
private:
bool isUnsigned(const Variable *var) const;

View File

@ -2342,7 +2342,7 @@ static void setVarIdClassFunction(const std::string &classname,
for (Token *tok2 = startToken; tok2 && tok2 != endToken; tok2 = tok2->next()) {
if (tok2->varId() != 0 || !tok2->isName())
continue;
if (Token::Match(tok2->tokAt(-2), ("!!"+classname+" :: ").c_str()))
if (Token::Match(tok2->tokAt(-2), ("!!"+classname+" ::").c_str()))
continue;
if (Token::Match(tok2->tokAt(-2), "!!this . "))
continue;