CheckMemoryLeak: Updated the handling of 'case' and 'default' a little

This commit is contained in:
Daniel Marjamäki 2008-08-23 13:16:25 +00:00
parent a7f82f5e57
commit 7269dfa336
1 changed files with 24 additions and 8 deletions

View File

@ -249,14 +249,23 @@ static TOKEN *getcode(const TOKEN *tok, const char varname[])
{
addtoken("if(!var)");
}
else
else if ( Match(tok, "if") ||
Match(tok, "else") ||
Match(tok, "switch") )
{
if (Match(tok, "if") ||
Match(tok, "else") ||
Match(tok, "switch") ||
Match(tok, "case") ||
Match(tok, "default"))
addtoken(tok->str);
addtoken(tok->str);
}
if ( Match(tok, "case") )
{
addtoken("case");
addtoken(";");
}
if ( Match(tok, "default") )
{
addtoken("case");
addtoken(";");
}
// Loops..
@ -429,12 +438,19 @@ static void CheckMemoryLeak_CheckScope( const TOKEN *Tok1, const char varname[]
done = false;
}
// Delete second use in "use ; use;"
// Delete second use in "use ; use ;"
while (Match(tok2, "use ; use ;"))
{
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;
}
}
}