From fa7f8ddc78eaaf313600ebf904020b60d2ecea5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 16 Jul 2013 09:40:31 +0200 Subject: [PATCH] Library: Renamed Argument to ArgumentChecks to make it a bit more clear --- lib/library.cpp | 6 +++--- lib/library.h | 18 +++++++++--------- test/testnullpointer.cpp | 22 +++++++++++----------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/lib/library.cpp b/lib/library.cpp index 141f51157..97f24811e 100644 --- a/lib/library.cpp +++ b/lib/library.cpp @@ -36,7 +36,7 @@ Library::Library() : allocid(0) Library::Library(const Library &lib) : use(lib.use), ignore(lib.ignore), - functionArgument(lib.functionArgument), + argumentChecks(lib.argumentChecks), returnuninitdata(lib.returnuninitdata), allocid(lib.allocid), _alloc(lib._alloc), @@ -101,8 +101,8 @@ bool Library::load(const char path[]) else return false; } - functionArgument[name][nr].notnull = notnull; - functionArgument[name][nr].notuninit = notuninit; + argumentChecks[name][nr].notnull = notnull; + argumentChecks[name][nr].notuninit = notuninit; } else return false; } diff --git a/lib/library.h b/lib/library.h index 80b1595d4..300a71d83 100644 --- a/lib/library.h +++ b/lib/library.h @@ -71,21 +71,21 @@ public: return (it != _noreturn.end() && !it->second); } - struct Argument { + struct ArgumentChecks { bool notnull; bool notuninit; }; // function name, argument nr => argument data - std::map > functionArgument; + std::map > argumentChecks; bool isnullargbad(const std::string &functionName, int argnr) const { - const Argument *arg = getarg(functionName,argnr); + const ArgumentChecks *arg = getarg(functionName,argnr); return arg && arg->notnull; } bool isuninitargbad(const std::string &functionName, int argnr) const { - const Argument *arg = getarg(functionName,argnr); + const ArgumentChecks *arg = getarg(functionName,argnr); return arg && arg->notuninit; } @@ -97,11 +97,11 @@ private: std::map _dealloc; // deallocation functions std::map _noreturn; // is function noreturn? - const Argument * getarg(const std::string &functionName, int argnr) const { - std::map >::const_iterator it1; - it1 = functionArgument.find(functionName); - if (it1 != functionArgument.end()) { - const std::map::const_iterator it2 = it1->second.find(argnr); + const ArgumentChecks * getarg(const std::string &functionName, int argnr) const { + std::map >::const_iterator it1; + it1 = argumentChecks.find(functionName); + if (it1 != argumentChecks.end()) { + const std::map::const_iterator it2 = it1->second.find(argnr); if (it2 != it1->second.end()) return &it2->second; } diff --git a/test/testnullpointer.cpp b/test/testnullpointer.cpp index 6907d88e7..7308a5ae8 100644 --- a/test/testnullpointer.cpp +++ b/test/testnullpointer.cpp @@ -2116,9 +2116,9 @@ private: // nothing bad.. { Library library; - Library::Argument arg = {false, false}; - library.functionArgument["x"][1] = arg; - library.functionArgument["x"][2] = arg; + Library::ArgumentChecks arg = {false, false}; + library.argumentChecks["x"][1] = arg; + library.argumentChecks["x"][2] = arg; std::list null, uninit; CheckNullPointer::parseFunctionCall(*xtok, null, &library, 0U); @@ -2130,10 +2130,10 @@ private: // for 1st parameter null pointer is not ok.. { Library library; - struct Library::Argument arg = {false, false}; - library.functionArgument["x"][1] = arg; - library.functionArgument["x"][2] = arg; - library.functionArgument["x"][1].notnull = true; + struct Library::ArgumentChecks arg = {false, false}; + library.argumentChecks["x"][1] = arg; + library.argumentChecks["x"][2] = arg; + library.argumentChecks["x"][1].notnull = true; std::list null,uninit; CheckNullPointer::parseFunctionCall(*xtok, null, &library, 0U); @@ -2146,10 +2146,10 @@ private: // for 2nd parameter uninit data is not ok.. { Library library; - Library::Argument arg = {false, false}; - library.functionArgument["x"][1] = arg; - library.functionArgument["x"][2] = arg; - library.functionArgument["x"][2].notuninit = true; + Library::ArgumentChecks arg = {false, false}; + library.argumentChecks["x"][1] = arg; + library.argumentChecks["x"][2] = arg; + library.argumentChecks["x"][2].notuninit = true; std::list null,uninit; CheckNullPointer::parseFunctionCall(*xtok, null, &library, 0U);