Refactor lib/checkleakautovar.cpp

This commit is contained in:
jrp2014 2018-04-05 15:58:28 +02:00 committed by Daniel Marjamäki
parent c367fc9f09
commit 94048d93f6
1 changed files with 4 additions and 5 deletions

View File

@ -53,10 +53,10 @@ static const CWE CWE415(415U);
void VarInfo::print()
{
std::cout << "size=" << alloctype.size() << std::endl;
std::map<unsigned int, AllocInfo>::const_iterator it;
for (it = alloctype.begin(); it != alloctype.end(); ++it) {
for (std::map<unsigned int, AllocInfo>::const_iterator it = alloctype.begin(); it != alloctype.end(); ++it) {
std::string strusage;
std::map<unsigned int, std::string>::const_iterator use = possibleUsage.find(it->first);
const std::map<unsigned int, std::string>::const_iterator use =
possibleUsage.find(it->first);
if (use != possibleUsage.end())
strusage = use->second;
@ -88,8 +88,7 @@ void VarInfo::print()
void VarInfo::possibleUsageAll(const std::string &functionName)
{
possibleUsage.clear();
std::map<unsigned int, AllocInfo>::const_iterator it;
for (it = alloctype.begin(); it != alloctype.end(); ++it)
for (std::map<unsigned int, AllocInfo>::const_iterator it = alloctype.begin(); it != alloctype.end(); ++it)
possibleUsage[it->first] = functionName;
}