From 2ec5d8953e1368b9f28ab262ca9cb03727391d56 Mon Sep 17 00:00:00 2001 From: PKEuS Date: Sun, 31 Mar 2013 01:26:09 -0700 Subject: [PATCH] Small refactorization in threadexecutor.cpp: Use prefix increment; Reuse iterator. --- cli/threadexecutor.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cli/threadexecutor.cpp b/cli/threadexecutor.cpp index 96972cd2c..660dfb32c 100644 --- a/cli/threadexecutor.cpp +++ b/cli/threadexecutor.cpp @@ -409,13 +409,14 @@ unsigned int __stdcall ThreadExecutor::threadProc(void *args) } const std::string &file = it->first; const std::size_t fileSize = it->second; - it++; + ++it; LeaveCriticalSection(&threadExecutor->_fileSync); - if (!threadExecutor->_fileContents.empty() && threadExecutor->_fileContents.find(file) != threadExecutor->_fileContents.end()) { + std::map::const_iterator fileContent = threadExecutor->_fileContents.find(file); + if (fileContent != threadExecutor->_fileContents.end()) { // File content was given as a string - result += fileChecker.check(file, threadExecutor->_fileContents[file]); + result += fileChecker.check(file, fileContent->second); } else { // Read file from a file result += fileChecker.check(file);