CheckMemoryLeak: Updated the handling of 'case' and 'default' a little
This commit is contained in:
parent
a7f82f5e57
commit
7269dfa336
|
@ -249,16 +249,25 @@ static TOKEN *getcode(const TOKEN *tok, const char varname[])
|
|||
{
|
||||
addtoken("if(!var)");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Match(tok, "if") ||
|
||||
else if ( Match(tok, "if") ||
|
||||
Match(tok, "else") ||
|
||||
Match(tok, "switch") ||
|
||||
Match(tok, "case") ||
|
||||
Match(tok, "default"))
|
||||
Match(tok, "switch") )
|
||||
{
|
||||
addtoken(tok->str);
|
||||
}
|
||||
|
||||
if ( Match(tok, "case") )
|
||||
{
|
||||
addtoken("case");
|
||||
addtoken(";");
|
||||
}
|
||||
|
||||
if ( Match(tok, "default") )
|
||||
{
|
||||
addtoken("case");
|
||||
addtoken(";");
|
||||
}
|
||||
|
||||
// Loops..
|
||||
if (Match(tok, "for") || Match(tok, "while") || Match(tok, "do") )
|
||||
addtoken("loop");
|
||||
|
@ -435,6 +444,13 @@ static void CheckMemoryLeak_CheckScope( const TOKEN *Tok1, const char varname[]
|
|||
erase(tok2, gettok(tok2,3));
|
||||
done = false;
|
||||
}
|
||||
|
||||
// Delete second case in "case ; case ;"
|
||||
while (Match(tok2, "case ; case ;"))
|
||||
{
|
||||
erase(tok2, gettok(tok2,3));
|
||||
done = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue