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