Fixed some "is passed by value" errors from cppcheck source.

This commit is contained in:
Reijo Tomperi 2009-09-10 22:22:57 +03:00
parent a6c809226e
commit 9828117aff
2 changed files with 4 additions and 4 deletions

View File

@ -275,7 +275,7 @@ CheckMemoryLeak::AllocType CheckMemoryLeak::getDeallocationType(const Token *tok
//--------------------------------------------------------------------------
void CheckMemoryLeak::memoryLeak(const Token *tok, const std::string varname, AllocType alloctype, bool all)
void CheckMemoryLeak::memoryLeak(const Token *tok, const std::string &varname, AllocType alloctype, bool all)
{
if (alloctype == CheckMemoryLeak::File ||
alloctype == CheckMemoryLeak::Pipe ||
@ -1662,7 +1662,7 @@ const Token *CheckMemoryLeakInFunction::findleak(const Token *tokens, bool all)
// Check for memory leaks for a function variable.
void CheckMemoryLeakInFunction::checkScope(const Token *Tok1, const std::string varname, unsigned int varid, bool classmember, unsigned int sz)
void CheckMemoryLeakInFunction::checkScope(const Token *Tok1, const std::string &varname, unsigned int varid, bool classmember, unsigned int sz)
{
std::list<const Token *> callstack;

View File

@ -84,7 +84,7 @@ public:
/** What type of allocation are used.. the "Many" means that several types of allocation and deallocation are used */
enum AllocType { No, Malloc, gMalloc, New, NewArray, File, Fd, Pipe, Dir, Many };
void memoryLeak(const Token *tok, const std::string varname, AllocType alloctype, bool all);
void memoryLeak(const Token *tok, const std::string &varname, AllocType alloctype, bool all);
/**
* Get type of deallocation at given position
@ -245,7 +245,7 @@ private:
* @param classmember is the scope inside a class member function
* @param sz size of type.. if the variable is a "int *" then sz should be "sizeof(int)"
*/
void checkScope(const Token *Tok1, const std::string varname, unsigned int varid, bool classmember, unsigned int sz);
void checkScope(const Token *Tok1, const std::string &varname, unsigned int varid, bool classmember, unsigned int sz);
void getErrorMessages()
{