MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / countPar

Function countPar

lib/checkcondition.cpp:1435–1447  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1433}
1434
1435static int countPar(const Token *tok1, const Token *tok2)
1436{
1437 int par = 0;
1438 for (const Token *tok = tok1; tok && tok != tok2; tok = tok->next()) {
1439 if (tok->str() == "(")
1440 ++par;
1441 else if (tok->str() == ")")
1442 --par;
1443 else if (tok->str() == ";")
1444 return -1;
1445 }
1446 return par;
1447}
1448
1449//---------------------------------------------------------------------------
1450// Clarify condition '(x = a < 0)' into '((x = a) < 0)' or '(x = (a < 0))'

Callers 1

clarifyConditionMethod · 0.85

Calls 2

nextMethod · 0.80
strMethod · 0.45

Tested by

no test coverage detected