CheckMemoryLeak: Refactoring the code
This commit is contained in:
parent
779dba9160
commit
ca4015f905
|
@ -1588,17 +1588,19 @@ Token *CheckMemoryLeakInFunction::getcode(const Token *tok, std::list<const Toke
|
||||||
}
|
}
|
||||||
|
|
||||||
// Callback..
|
// Callback..
|
||||||
bool matchFirst = Token::Match(tok, "( %var%");
|
if (Token::Match(tok, "( *| %var%") && Token::simpleMatch(tok->link(),") ("))
|
||||||
if (matchFirst || Token::Match(tok, "( * %var%"))
|
|
||||||
{
|
{
|
||||||
int tokIdx = matchFirst ? 2 : 3;
|
const Token *tok2 = tok->next();
|
||||||
|
if (tok2->str() == "*")
|
||||||
|
tok2 = tok2->next();
|
||||||
|
tok2 = tok2->next();
|
||||||
|
|
||||||
while (Token::Match(tok->tokAt(tokIdx), ". %var%"))
|
while (Token::Match(tok2, ". %var%"))
|
||||||
tokIdx += 2;
|
tok2 = tok2->tokAt(2);
|
||||||
|
|
||||||
if (Token::simpleMatch(tok->tokAt(tokIdx), ") ("))
|
if (Token::simpleMatch(tok2, ") ("))
|
||||||
{
|
{
|
||||||
for (const Token *tok2 = tok->tokAt(tokIdx + 2); tok2; tok2 = tok2->next())
|
for (; tok2; tok2 = tok2->next())
|
||||||
{
|
{
|
||||||
if (Token::Match(tok2, "[;{]"))
|
if (Token::Match(tok2, "[;{]"))
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue