refactoring : Replaced 'findtoken' with 'findmatch'
This commit is contained in:
parent
37e8019230
commit
46631089aa
|
@ -55,9 +55,8 @@ void CheckOther::WarningOldStylePointerCast()
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Is "type" a class?
|
// Is "type" a class?
|
||||||
const char *pattern[] = {"class","",NULL};
|
const std::string pattern("class " + tok->next()->str());
|
||||||
pattern[1] = tok->strAt(1);
|
if (!TOKEN::findmatch(_tokenizer->tokens(), pattern.c_str()))
|
||||||
if (!TOKEN::findtoken(_tokenizer->tokens(), pattern))
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
|
@ -566,16 +565,8 @@ void CheckOther::CheckConstantFunctionParameter()
|
||||||
else if ( TOKEN::Match(tok,"[,(] const %type% %var% [,)]") )
|
else if ( TOKEN::Match(tok,"[,(] const %type% %var% [,)]") )
|
||||||
{
|
{
|
||||||
// Check if type is a struct or class.
|
// Check if type is a struct or class.
|
||||||
const char *pattern[3] = {"class","type",0};
|
const std::string pattern(std::string("class|struct ") + tok->strAt(2));
|
||||||
pattern[1] = tok->strAt( 2);
|
if ( TOKEN::findmatch(_tokenizer->tokens(), pattern.c_str()) )
|
||||||
if ( TOKEN::findtoken(_tokenizer->tokens(), pattern) )
|
|
||||||
{
|
|
||||||
std::ostringstream errmsg;
|
|
||||||
errmsg << _tokenizer->fileLine(tok) << " " << tok->strAt(3) << " is passed by value, it could be passed by reference/pointer instead";
|
|
||||||
_errorLogger->reportErr( errmsg.str() );
|
|
||||||
}
|
|
||||||
pattern[0] = "struct";
|
|
||||||
if ( TOKEN::findtoken(_tokenizer->tokens(), pattern) )
|
|
||||||
{
|
{
|
||||||
std::ostringstream errmsg;
|
std::ostringstream errmsg;
|
||||||
errmsg << _tokenizer->fileLine(tok) << " " << tok->strAt(3) << " is passed by value, it could be passed by reference/pointer instead";
|
errmsg << _tokenizer->fileLine(tok) << " " << tok->strAt(3) << " is passed by value, it could be passed by reference/pointer instead";
|
||||||
|
|
Loading…
Reference in New Issue