diff --git a/src/checkdangerousfunctions.cpp b/src/checkdangerousfunctions.cpp index 365ba7481..4139251dd 100644 --- a/src/checkdangerousfunctions.cpp +++ b/src/checkdangerousfunctions.cpp @@ -49,20 +49,6 @@ CheckDangerousFunctionsClass::~CheckDangerousFunctionsClass() } -// Modified version of 'ReportError' that also reports the callstack -void CheckDangerousFunctionsClass::ReportError(const std::string &errmsg) -{ - std::ostringstream ostr; - std::list::const_iterator it; - for (it = _callStack.begin(); it != _callStack.end(); it++) - ostr << _tokenizer->fileLine(*it) << " -> "; - ostr << errmsg; - _errorLogger->reportErr(ostr.str()); -} -//--------------------------------------------------------------------------- - - - //--------------------------------------------------------------------------- // Dangerous functions //--------------------------------------------------------------------------- diff --git a/src/checkdangerousfunctions.h b/src/checkdangerousfunctions.h index 127b6d941..9eaf3798d 100644 --- a/src/checkdangerousfunctions.h +++ b/src/checkdangerousfunctions.h @@ -37,15 +37,9 @@ public: private: - /** Report error using the callstack */ - void ReportError(const std::string &errmsg); - const Tokenizer *_tokenizer; const Settings _settings; ErrorLogger *_errorLogger; - - /** callstack - used during intra-function checking */ - std::list _callStack; }; //--------------------------------------------------------------------------- diff --git a/src/checkmemoryleak.cpp b/src/checkmemoryleak.cpp index 19cbad422..64dc72195 100644 --- a/src/checkmemoryleak.cpp +++ b/src/checkmemoryleak.cpp @@ -315,7 +315,7 @@ void CheckMemoryLeakClass::MemoryLeak(const Token *tok, const char varname[], Al } //--------------------------------------------------------------------------- -bool CheckMemoryLeakClass::MatchFunctionsThatReturnArg(const Token *tok, const std::string varname) +bool CheckMemoryLeakClass::MatchFunctionsThatReturnArg(const Token *tok, const std::string &varname) { return Token::Match(tok, std::string("; " + varname + " = strcat|memcpy|memmove|strcpy ( " + varname + " ,").c_str()); } diff --git a/src/checkmemoryleak.h b/src/checkmemoryleak.h index 65425990c..b9e7c74cc 100644 --- a/src/checkmemoryleak.h +++ b/src/checkmemoryleak.h @@ -90,7 +90,7 @@ private: */ Token *getcode(const Token *tok, std::list callstack, const char varname[], AllocType &alloctype, AllocType &dealloctype, bool classmember, bool &all); bool notvar(const Token *tok, const char *varnames[]); - bool MatchFunctionsThatReturnArg(const Token *tok, const std::string varname); + bool MatchFunctionsThatReturnArg(const Token *tok, const std::string &varname); void MemoryLeak(const Token *tok, const char varname[], AllocType alloctype, bool all); void MismatchError(const Token *Tok1, const std::list &callstack, const char varname[]); const char * call_func(const Token *tok, std::list callstack, const char *varnames[], AllocType &alloctype, AllocType &dealloctype, bool &all);