From ff3d1db4806426e21610d794ed75e2d181e254c3 Mon Sep 17 00:00:00 2001 From: Slava Semushin Date: Wed, 26 Aug 2009 02:25:27 +0700 Subject: [PATCH] Replace "const unsigned int" to "unsigned int" in methods parameters. No functional change. --- src/checkmemoryleak.cpp | 16 ++++++++-------- src/checkmemoryleak.h | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/checkmemoryleak.cpp b/src/checkmemoryleak.cpp index 203560c8e..c7b69d8c0 100644 --- a/src/checkmemoryleak.cpp +++ b/src/checkmemoryleak.cpp @@ -76,7 +76,7 @@ bool CheckMemoryLeak::isclass(const Tokenizer *_tokenizer, const Token *tok) con } //--------------------------------------------------------------------------- -CheckMemoryLeak::AllocType CheckMemoryLeak::getAllocationType(const Token *tok2, const unsigned int varid) const +CheckMemoryLeak::AllocType CheckMemoryLeak::getAllocationType(const Token *tok2, unsigned int varid) const { // What we may have... // * var = (char *)malloc(10); @@ -160,7 +160,7 @@ CheckMemoryLeak::AllocType CheckMemoryLeak::getAllocationType(const Token *tok2, -CheckMemoryLeak::AllocType CheckMemoryLeak::getReallocationType(const Token *tok2, const unsigned int varid) const +CheckMemoryLeak::AllocType CheckMemoryLeak::getReallocationType(const Token *tok2, unsigned int varid) const { // What we may have... // * var = (char *)realloc(..; @@ -186,7 +186,7 @@ CheckMemoryLeak::AllocType CheckMemoryLeak::getReallocationType(const Token *tok } -CheckMemoryLeak::AllocType CheckMemoryLeak::getDeallocationType(const Token *tok, const unsigned int varid) const +CheckMemoryLeak::AllocType CheckMemoryLeak::getDeallocationType(const Token *tok, unsigned int varid) const { if (Token::Match(tok, "delete %varid% ;", varid)) return New; @@ -430,13 +430,13 @@ CheckMemoryLeak::AllocType CheckMemoryLeak::functionReturnType(const Token *tok) return No; } -bool CheckMemoryLeakInFunction::matchFunctionsThatReturnArg(const Token *tok, const unsigned int varid) const +bool CheckMemoryLeakInFunction::matchFunctionsThatReturnArg(const Token *tok, unsigned int varid) const { return Token::Match(tok, "; %varid% = strcat|memcpy|memmove|strcpy ( %varid% ,", varid); } -bool CheckMemoryLeakInFunction::notvar(const Token *tok, const unsigned int varid, bool endpar) const +bool CheckMemoryLeakInFunction::notvar(const Token *tok, unsigned int varid, bool endpar) const { const std::string end(endpar ? " &&|)" : " [;)&|]"); return bool(Token::Match(tok, ("! %varid%" + end).c_str(), varid) || @@ -472,7 +472,7 @@ static int countParameters(const Token *tok) return -1; } -const char * CheckMemoryLeakInFunction::call_func(const Token *tok, std::list callstack, const unsigned int varid, AllocType &alloctype, AllocType &dealloctype, bool &all, unsigned int sz) +const char * CheckMemoryLeakInFunction::call_func(const Token *tok, std::list callstack, unsigned int varid, AllocType &alloctype, AllocType &dealloctype, bool &all, unsigned int sz) { if (bsearch(tok->str().c_str(), call_func_white_list, sizeof(call_func_white_list) / sizeof(call_func_white_list[0]), @@ -575,7 +575,7 @@ const char * CheckMemoryLeakInFunction::call_func(const Token *tok, std::list callstack, const unsigned int varid, AllocType &alloctype, AllocType &dealloctype, bool classmember, bool &all, unsigned int sz) +Token *CheckMemoryLeakInFunction::getcode(const Token *tok, std::list callstack, unsigned int varid, AllocType &alloctype, AllocType &dealloctype, bool classmember, bool &all, unsigned int sz) { Token *rethead = 0, *rettail = 0; #define addtoken(_str) \ @@ -1566,7 +1566,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, const 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 callstack; diff --git a/src/checkmemoryleak.h b/src/checkmemoryleak.h index 0454eb38f..f856a250a 100644 --- a/src/checkmemoryleak.h +++ b/src/checkmemoryleak.h @@ -101,17 +101,17 @@ public: * @param varname variable name * @return type of deallocation */ - AllocType getDeallocationType(const Token *tok, const unsigned int varid) const; + AllocType getDeallocationType(const Token *tok, unsigned int varid) const; /** * Get type of allocation at given position */ - AllocType getAllocationType(const Token *tok2, const unsigned int varid) const; + AllocType getAllocationType(const Token *tok2, unsigned int varid) const; /** * Get type of reallocation at given position */ - AllocType getReallocationType(const Token *tok2, const unsigned int varid) const; + AllocType getReallocationType(const Token *tok2, unsigned int varid) const; bool isclass(const Tokenizer *_tokenizer, const Token *typestr) const; @@ -164,7 +164,7 @@ public: private: #endif - bool matchFunctionsThatReturnArg(const Token *tok, const unsigned int varid) const; + bool matchFunctionsThatReturnArg(const Token *tok, unsigned int varid) const; /** * Check if there is a "!var" match inside a condition @@ -173,7 +173,7 @@ private: * @param endpar if this is true the "!var" must be followed by ")" * @return true if match */ - bool notvar(const Token *tok, const unsigned int varid, bool endpar = false) const; + bool notvar(const Token *tok, unsigned int varid, bool endpar = false) const; /** * Inspect a function call. the call_func and getcode are recursive @@ -194,7 +194,7 @@ private: * - "callfunc" * - "&use" */ - const char * call_func(const Token *tok, std::list callstack, const unsigned int varid, AllocType &alloctype, AllocType &dealloctype, bool &all, unsigned int sz); + const char * call_func(const Token *tok, std::list callstack, unsigned int varid, AllocType &alloctype, AllocType &dealloctype, bool &all, unsigned int sz); /** * Extract a new tokens list that is easier to parse than the "_tokenizer->tokens()", the @@ -228,7 +228,7 @@ private: * - goto : corresponds to a "goto" * - return : corresponds to a "return" */ - Token *getcode(const Token *tok, std::list callstack, const unsigned int varid, AllocType &alloctype, AllocType &dealloctype, bool classmember, bool &all, unsigned int sz); + Token *getcode(const Token *tok, std::list callstack, unsigned int varid, AllocType &alloctype, AllocType &dealloctype, bool classmember, bool &all, unsigned int sz); /** * Simplify code e.g. by replacing empty "{ }" with ";" @@ -246,7 +246,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, const 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() {