CheckHeaders: Refactoring so str and Match is used instead of aaaa and
strcmp etc
This commit is contained in:
parent
62e363daa5
commit
e385bcd83b
|
@ -85,7 +85,7 @@ void CheckHeaders::WarningIncludeHeader()
|
||||||
// Including..
|
// Including..
|
||||||
for ( const TOKEN *includetok = _tokenizer->tokens(); includetok; includetok = includetok->next)
|
for ( const TOKEN *includetok = _tokenizer->tokens(); includetok; includetok = includetok->next)
|
||||||
{
|
{
|
||||||
if (strcmp(includetok->aaaa(), "#include") != 0)
|
if (includetok->str() != "#include")
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Get fileindex of included file..
|
// Get fileindex of included file..
|
||||||
|
@ -118,11 +118,11 @@ void CheckHeaders::WarningIncludeHeader()
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// I'm only interested in stuff that is declared at indentlevel 0
|
// I'm only interested in stuff that is declared at indentlevel 0
|
||||||
if (tok1->aaaa0() == '{')
|
if (tok1->str() == "{")
|
||||||
indentlevel++;
|
++indentlevel;
|
||||||
|
|
||||||
else if (tok1->aaaa0() == '}')
|
else if (tok1->str() == "}")
|
||||||
indentlevel--;
|
--indentlevel;
|
||||||
|
|
||||||
if (indentlevel != 0)
|
if (indentlevel != 0)
|
||||||
continue;
|
continue;
|
||||||
|
@ -148,13 +148,13 @@ void CheckHeaders::WarningIncludeHeader()
|
||||||
|
|
||||||
// enum..
|
// enum..
|
||||||
// --------------------------------------
|
// --------------------------------------
|
||||||
else if (strcmp(tok1->aaaa(), "enum") == 0)
|
else if (tok1->str() == "enum")
|
||||||
{
|
{
|
||||||
tok1 = tok1->next;
|
tok1 = tok1->next;
|
||||||
while (tok1->next && tok1->aaaa0()!=';')
|
while ( ! TOKEN::Match( tok1, "; %any%" ) )
|
||||||
{
|
{
|
||||||
if ( tok1->isName() )
|
if ( tok1->isName() )
|
||||||
namelist.push_back(tok1->aaaa());
|
namelist.push_back(tok1->str());
|
||||||
tok1 = tok1->next;
|
tok1 = tok1->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -175,26 +175,26 @@ void CheckHeaders::WarningIncludeHeader()
|
||||||
|
|
||||||
// typedef..
|
// typedef..
|
||||||
// --------------------------------------
|
// --------------------------------------
|
||||||
else if (strcmp(tok1->aaaa(),"typedef")==0)
|
else if (tok1->str() == "typedef")
|
||||||
{
|
{
|
||||||
if (strcmp(tok1->strAt(1),"enum")==0)
|
if (strcmp(tok1->strAt(1),"enum")==0)
|
||||||
continue;
|
continue;
|
||||||
int parlevel = 0;
|
int parlevel = 0;
|
||||||
while (tok1->next)
|
while (tok1->next)
|
||||||
{
|
{
|
||||||
if ( strchr("({", tok1->aaaa0()) )
|
if ( TOKEN::Match(tok1, "[({]") )
|
||||||
parlevel++;
|
parlevel++;
|
||||||
|
|
||||||
else if ( strchr(")}", tok1->aaaa0()) )
|
else if ( TOKEN::Match(tok1, "[)}]") )
|
||||||
parlevel--;
|
parlevel--;
|
||||||
|
|
||||||
else if (parlevel == 0)
|
else if (parlevel == 0)
|
||||||
{
|
{
|
||||||
if ( tok1->aaaa0() == ';' )
|
if ( tok1->str() == ";" )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if ( TOKEN::Match(tok1, "%var% ;") )
|
if ( TOKEN::Match(tok1, "%var% ;") )
|
||||||
namelist.push_back(tok1->aaaa());
|
namelist.push_back(tok1->str());
|
||||||
}
|
}
|
||||||
|
|
||||||
tok1 = tok1->next;
|
tok1 = tok1->next;
|
||||||
|
|
Loading…
Reference in New Issue