Skip to content

Commit dfd9d32

Browse files
committed
Refactorization: Removed whitespaces at the end of a token
Removed a redundant 'void'
1 parent ddf3444 commit dfd9d32

4 files changed

Lines changed: 8 additions & 8 deletions

File tree

lib/checkclass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ void CheckClass::initializeVarList(const Function &func, std::list<const Functio
577577
ftok = ftok->tokAt(2);
578578

579579
// Skip "classname :: "
580-
if (Token::Match(ftok, ":: %var% "))
580+
if (Token::Match(ftok, ":: %var%"))
581581
ftok = ftok->next();
582582
while (Token::Match(ftok, "%var% ::"))
583583
ftok = ftok->tokAt(2);

lib/checkother.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2566,7 +2566,7 @@ void CheckOther::checkInvalidFree()
25662566

25672567
// If a previously-allocated pointer is assigned a completely new value,
25682568
// we can't know if any subsequent free() on that pointer is valid or not.
2569-
else if (Token::Match(tok, "%var% = ")) {
2569+
else if (Token::Match(tok, "%var% =")) {
25702570
allocatedVariables.erase(tok->varId());
25712571
}
25722572

@@ -2819,18 +2819,18 @@ void CheckOther::checkAlwaysTrueOrFalseStringCompare()
28192819

28202820
for (const Token* tok = _tokenizer->tokens(); tok; tok = tok->next()) {
28212821
if (Token::Match(tok, "strncmp|strcmp|stricmp|strcmpi|strcasecmp|wcscmp|wcsncmp (")) {
2822-
if (Token::Match(tok->tokAt(2), "%str% , %str% ")) {
2822+
if (Token::Match(tok->tokAt(2), "%str% , %str%")) {
28232823
const std::string &str1 = tok->strAt(2);
28242824
const std::string &str2 = tok->strAt(4);
28252825
alwaysTrueFalseStringCompareError(tok, str1, str2);
28262826
tok = tok->tokAt(5);
2827-
} else if (Token::Match(tok->tokAt(2), "%var% , %var% ")) {
2827+
} else if (Token::Match(tok->tokAt(2), "%var% , %var%")) {
28282828
const std::string &str1 = tok->strAt(2);
28292829
const std::string &str2 = tok->strAt(4);
28302830
if (str1 == str2)
28312831
alwaysTrueStringVariableCompareError(tok, str1, str2);
28322832
tok = tok->tokAt(5);
2833-
} else if (Token::Match(tok->tokAt(2), "%var% . c_str ( ) , %var% . c_str ( ) ")) {
2833+
} else if (Token::Match(tok->tokAt(2), "%var% . c_str ( ) , %var% . c_str ( )")) {
28342834
const std::string &str1 = tok->strAt(2);
28352835
const std::string &str2 = tok->strAt(8);
28362836
if (str1 == str2)
@@ -2923,7 +2923,7 @@ void CheckOther::suspiciousStringCompareError(const Token* tok, const std::strin
29232923
// Reference:
29242924
// - http://www.cplusplus.com/reference/cmath/
29252925
//-----------------------------------------------------------------------------
2926-
void CheckOther::checkComparisonFunctionIsAlwaysTrueOrFalse(void)
2926+
void CheckOther::checkComparisonFunctionIsAlwaysTrueOrFalse()
29272927
{
29282928
if (!_settings->isEnabled("warning"))
29292929
return;

lib/checkother.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ class CPPCHECKLIB CheckOther : public Check {
266266
void checkCastIntToCharAndBack();
267267

268268
/** @brief %Check for using of comparison functions evaluating always to true or false. */
269-
void checkComparisonFunctionIsAlwaysTrueOrFalse(void);
269+
void checkComparisonFunctionIsAlwaysTrueOrFalse();
270270

271271
private:
272272
bool isUnsigned(const Variable *var) const;

lib/tokenize.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2342,7 +2342,7 @@ static void setVarIdClassFunction(const std::string &classname,
23422342
for (Token *tok2 = startToken; tok2 && tok2 != endToken; tok2 = tok2->next()) {
23432343
if (tok2->varId() != 0 || !tok2->isName())
23442344
continue;
2345-
if (Token::Match(tok2->tokAt(-2), ("!!"+classname+" :: ").c_str()))
2345+
if (Token::Match(tok2->tokAt(-2), ("!!"+classname+" ::").c_str()))
23462346
continue;
23472347
if (Token::Match(tok2->tokAt(-2), "!!this . "))
23482348
continue;

0 commit comments

Comments
 (0)