CheckOther: Improved the check that checks 'if (condition) var=true;'

This commit is contained in:
Daniel Marjamäki 2007-06-09 18:36:52 +00:00
parent f0f117d4f6
commit 8a1ec67b22
1 changed files with 4 additions and 1 deletions

View File

@ -244,9 +244,10 @@ void WarningIf()
} }
// Search for 'if (condition) flag = true;' // Search for 'if (condition) flag = true;'
bool newstatement = false;
for (TOKEN *tok = tokens; tok; tok = tok->next) for (TOKEN *tok = tokens; tok; tok = tok->next)
{ {
if (strcmp(tok->str,"if")) if (!newstatement || strcmp(tok->str,"if"))
continue; continue;
int parlevel = 0; int parlevel = 0;
@ -287,6 +288,8 @@ void WarningIf()
} }
} }
} }
newstatement = (strchr("{};",tok->str[0]));
} }
} }