@@ -64,9 +64,9 @@ static bool isConstExpression(const Token *tok, const std::set<std::string> &con
6464
6565static bool isSameExpression (const Token *tok1, const Token *tok2, const std::set<std::string> &constFunctions)
6666{
67- if (tok1 == NULL && tok2 == NULL )
67+ if (tok1 == nullptr && tok2 == nullptr )
6868 return true ;
69- if (tok1 == NULL || tok2 == NULL )
69+ if (tok1 == nullptr || tok2 == nullptr )
7070 return false ;
7171 if (tok1->str () != tok2->str ())
7272 return false ;
@@ -949,7 +949,7 @@ void CheckOther::checkSwitchCaseFallThrough()
949949 for (const Token *tok2 = i->classStart ; tok2 != i->classEnd ; tok2 = tok2->next ()) {
950950 if (Token::simpleMatch (tok2, " if (" )) {
951951 tok2 = tok2->next ()->link ()->next ();
952- if (tok2->link () == NULL ) {
952+ if (tok2->link () == nullptr ) {
953953 std::ostringstream errmsg;
954954 errmsg << " unmatched if in switch: " << tok2->linenr ();
955955 reportError (_tokenizer->tokens (), Severity::debug, " debug" , errmsg.str ());
@@ -961,7 +961,7 @@ void CheckOther::checkSwitchCaseFallThrough()
961961 tok2 = tok2->next ()->link ()->next ();
962962 // skip over "do { } while ( ) ;" case
963963 if (tok2->str () == " {" ) {
964- if (tok2->link () == NULL ) {
964+ if (tok2->link () == nullptr ) {
965965 std::ostringstream errmsg;
966966 errmsg << " unmatched while in switch: " << tok2->linenr ();
967967 reportError (_tokenizer->tokens (), Severity::debug, " debug" , errmsg.str ());
@@ -972,7 +972,7 @@ void CheckOther::checkSwitchCaseFallThrough()
972972 justbreak = false ;
973973 } else if (Token::simpleMatch (tok2, " do {" )) {
974974 tok2 = tok2->next ();
975- if (tok2->link () == NULL ) {
975+ if (tok2->link () == nullptr ) {
976976 std::ostringstream errmsg;
977977 errmsg << " unmatched do in switch: " << tok2->linenr ();
978978 reportError (_tokenizer->tokens (), Severity::debug, " debug" , errmsg.str ());
@@ -982,7 +982,7 @@ void CheckOther::checkSwitchCaseFallThrough()
982982 justbreak = false ;
983983 } else if (Token::simpleMatch (tok2, " for (" )) {
984984 tok2 = tok2->next ()->link ()->next ();
985- if (tok2->link () == NULL ) {
985+ if (tok2->link () == nullptr ) {
986986 std::ostringstream errmsg;
987987 errmsg << " unmatched for in switch: " << tok2->linenr ();
988988 reportError (_tokenizer->tokens (), Severity::debug, " debug" , errmsg.str ());
@@ -1012,7 +1012,7 @@ void CheckOther::checkSwitchCaseFallThrough()
10121012 if (tok2->next ()->str () == " else" ) {
10131013 tok2 = tok2->tokAt (2 );
10141014 ifnest.pop ();
1015- if (tok2->link () == NULL ) {
1015+ if (tok2->link () == nullptr ) {
10161016 std::ostringstream errmsg;
10171017 errmsg << " unmatched if in switch: " << tok2->linenr ();
10181018 reportError (_tokenizer->tokens (), Severity::debug, " debug" , errmsg.str ());
@@ -1530,7 +1530,7 @@ void CheckOther::invalidFunctionUsage()
15301530 sprintfOverlappingDataError (tok2, tok2->str ());
15311531 break ;
15321532 }
1533- } while (NULL != (tok2 = tok2->nextArgument ()));
1533+ } while (nullptr != (tok2 = tok2->nextArgument ()));
15341534 }
15351535}
15361536
@@ -2198,7 +2198,7 @@ void CheckOther::checkZeroDivision()
21982198 // Value flow..
21992199 const ValueFlow::Value *value = tok->astOperand2 ()->getValue (0LL );
22002200 if (value) {
2201- if (value->condition == NULL )
2201+ if (value->condition == nullptr )
22022202 zerodivError (tok);
22032203 else if (_settings->isEnabled (" warning" ))
22042204 zerodivcondError (value->condition ,tok);
@@ -2628,7 +2628,7 @@ void CheckOther::checkInvalidFree()
26282628 // if it is later used to free memory
26292629 else if (Token::Match (tok, " %var% (" )) {
26302630 const Token* tok2 = Token::findmatch (tok->next (), " %var%" , tok->linkAt (1 ));
2631- while (tok2 != NULL ) {
2631+ while (tok2 != nullptr ) {
26322632 allocatedVariables.erase (tok2->varId ());
26332633 tok2 = Token::findmatch (tok2->next (), " %var%" , tok->linkAt (1 ));
26342634 }
@@ -2698,7 +2698,7 @@ void CheckOther::checkDoubleFree()
26982698 else if (tok->str () == " }" && tok->link () && tok->link ()->previous () &&
26992699 tok->link ()->linkAt (-1 ) &&
27002700 Token::Match (tok->link ()->linkAt (-1 )->previous (), " while|for" ) &&
2701- Token::findmatch (tok->link ()->linkAt (-1 ), " break|continue ;" , tok) != NULL ) {
2701+ Token::findmatch (tok->link ()->linkAt (-1 ), " break|continue ;" , tok) != nullptr ) {
27022702 freedVariables.clear ();
27032703 closeDirVariables.clear ();
27042704 }
@@ -2855,23 +2855,23 @@ void CheckOther::checkAlwaysTrueOrFalseStringCompare()
28552855 return ;
28562856
28572857 const Token *tok = _tokenizer->tokens ();
2858- while (tok && (tok = Token::findmatch (tok, " strncmp|strcmp|stricmp|strcmpi|strcasecmp|wcscmp|wcsncmp ( %str% , %str% " )) != NULL ) {
2858+ while (tok && (tok = Token::findmatch (tok, " strncmp|strcmp|stricmp|strcmpi|strcasecmp|wcscmp|wcsncmp ( %str% , %str% " )) != nullptr ) {
28592859 const std::string &str1 = tok->strAt (2 );
28602860 const std::string &str2 = tok->strAt (4 );
28612861 alwaysTrueFalseStringCompareError (tok, str1, str2);
28622862 tok = tok->tokAt (5 );
28632863 }
28642864
28652865 tok = _tokenizer->tokens ();
2866- while (tok && (tok = Token::findmatch (tok, " QString :: compare ( %str% , %str% )" )) != NULL ) {
2866+ while (tok && (tok = Token::findmatch (tok, " QString :: compare ( %str% , %str% )" )) != nullptr ) {
28672867 const std::string &str1 = tok->strAt (4 );
28682868 const std::string &str2 = tok->strAt (6 );
28692869 alwaysTrueFalseStringCompareError (tok, str1, str2);
28702870 tok = tok->tokAt (7 );
28712871 }
28722872
28732873 tok = _tokenizer->tokens ();
2874- while (tok && (tok = Token::findmatch (tok, " strncmp|strcmp|stricmp|strcmpi|strcasecmp|wcscmp|wcsncmp ( %var% , %var% " )) != NULL ) {
2874+ while (tok && (tok = Token::findmatch (tok, " strncmp|strcmp|stricmp|strcmpi|strcasecmp|wcscmp|wcsncmp ( %var% , %var% " )) != nullptr ) {
28752875 const std::string &str1 = tok->strAt (2 );
28762876 const std::string &str2 = tok->strAt (4 );
28772877 if (str1 == str2)
@@ -2880,7 +2880,7 @@ void CheckOther::checkAlwaysTrueOrFalseStringCompare()
28802880 }
28812881
28822882 tok = _tokenizer->tokens ();
2883- while (tok && (tok = Token::findmatch (tok, " !!+ %str% ==|!= %str% !!+" )) != NULL ) {
2883+ while (tok && (tok = Token::findmatch (tok, " !!+ %str% ==|!= %str% !!+" )) != nullptr ) {
28842884 const std::string &str1 = tok->strAt (1 );
28852885 const std::string &str2 = tok->strAt (3 );
28862886 alwaysTrueFalseStringCompareError (tok, str1, str2);
@@ -3318,7 +3318,7 @@ void CheckOther::oppositeInnerCondition()
33183318
33193319 if (scope->classDef ->strAt (6 ) == " {" ) {
33203320
3321- const char *oppositeCondition = NULL ;
3321+ const char *oppositeCondition = nullptr ;
33223322
33233323 if (scope->classDef ->strAt (3 ) == " ==" )
33243324 oppositeCondition = " if ( %any% !=|<|>|<=|>= %any% )" ;
@@ -3388,13 +3388,13 @@ void CheckOther::checkVarFuncNullUB()
33883388 ++argnr;
33893389 ftok = ftok->previous ();
33903390 }
3391- ftok = ftok ? ftok->previous () : NULL ;
3391+ ftok = ftok ? ftok->previous () : nullptr ;
33923392 if (ftok && ftok->isName ()) {
33933393 // If this is a variadic function then report error
33943394 const Function *f = ftok->function ();
33953395 if (f && f->argCount () <= argnr) {
33963396 const Token *tok2 = f->argDef ;
3397- tok2 = tok2 ? tok2->link () : NULL ; // goto ')'
3397+ tok2 = tok2 ? tok2->link () : nullptr ; // goto ')'
33983398 if (Token::simpleMatch (tok2->tokAt (-3 ), " . . ." ))
33993399 varFuncNullUBError (tok);
34003400 }
0 commit comments