Small refactorization in threadexecutor.cpp: Use prefix increment; Reuse iterator.

This commit is contained in:
PKEuS 2013-03-31 01:26:09 -07:00
parent f08a01fb26
commit 2ec5d8953e
1 changed files with 4 additions and 3 deletions

View File

@ -409,13 +409,14 @@ unsigned int __stdcall ThreadExecutor::threadProc(void *args)
} }
const std::string &file = it->first; const std::string &file = it->first;
const std::size_t fileSize = it->second; const std::size_t fileSize = it->second;
it++; ++it;
LeaveCriticalSection(&threadExecutor->_fileSync); LeaveCriticalSection(&threadExecutor->_fileSync);
if (!threadExecutor->_fileContents.empty() && threadExecutor->_fileContents.find(file) != threadExecutor->_fileContents.end()) { std::map<std::string, std::string>::const_iterator fileContent = threadExecutor->_fileContents.find(file);
if (fileContent != threadExecutor->_fileContents.end()) {
// File content was given as a string // File content was given as a string
result += fileChecker.check(file, threadExecutor->_fileContents[file]); result += fileChecker.check(file, fileContent->second);
} else { } else {
// Read file from a file // Read file from a file
result += fileChecker.check(file); result += fileChecker.check(file);