diff --git a/lib/checkother.cpp b/lib/checkother.cpp index 76f256c26..da2b94b10 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -155,7 +155,7 @@ void CheckOther::clarifyCondition() tok2 = tok2->link(); else if (Token::Match(tok2, "<|<=|==|!=|>|>=")) { // This might be a template - if (!_tokenizer->code_is_c() && Token::Match(tok2->previous(), "%var% <")) + if (!_tokenizer->isC() && Token::Match(tok2->previous(), "%var% <")) break; clarifyConditionError(tok, tok->strAt(2) == "=", false); @@ -2246,7 +2246,7 @@ static bool isFunction(const std::string &name, const Token *startToken) void CheckOther::checkMisusedScopedObject() { // Skip this check for .c files - if (_tokenizer->code_is_c()) { + if (_tokenizer->isC()) { return; } diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 8d4eac617..de3deb59f 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -5674,7 +5674,7 @@ void Tokenizer::simplifyFunctionParameters() void Tokenizer::simplifyPointerToStandardType() { - if (!code_is_c()) + if (!isC()) return; for (Token *tok = _tokens; tok; tok = tok->next()) { @@ -10086,17 +10086,3 @@ void Tokenizer::printUnknownTypes() _errorLogger->reportOut(ss.str()); } } - -bool Tokenizer::code_is_c() const -{ - const std::string fname = getFiles()->at(0); - const size_t position = fname.rfind("."); - - if (position != std::string::npos) { - const std::string ext = fname.substr(position); - if (ext == ".c" || ext == ".C") - return true; - } - - return false; -} diff --git a/lib/tokenize.h b/lib/tokenize.h index 5fc491bd8..d359f98da 100644 --- a/lib/tokenize.h +++ b/lib/tokenize.h @@ -792,9 +792,6 @@ public: */ void printUnknownTypes(); - /** Checks if the file extensions is .c or .C */ - bool code_is_c() const; - private: /** Disable copy constructor, no implementation */ Tokenizer(const Tokenizer &);