Two small refactorizations:

- Avoid leaving and entering again critical section without doing anything
- Use isPointer() in checkbufferoverrun.cpp instead of string comparison
This commit is contained in:
PKEuS 2015-01-10 21:03:21 +01:00
parent d019b7f9a6
commit fd2f93bb80
2 changed files with 1 additions and 8 deletions

View File

@ -422,12 +422,7 @@ unsigned int __stdcall ThreadExecutor::threadProc(void *args)
CppCheck fileChecker(*threadExecutor, false);
fileChecker.settings() = threadExecutor->_settings;
LeaveCriticalSection(&threadExecutor->_fileSync);
for (;;) {
EnterCriticalSection(&threadExecutor->_fileSync);
if (it == threadExecutor->_files.end()) {
LeaveCriticalSection(&threadExecutor->_fileSync);
return result;
@ -457,8 +452,6 @@ unsigned int __stdcall ThreadExecutor::threadProc(void *args)
CppCheckExecutor::reportStatus(threadExecutor->_processedFiles, threadExecutor->_totalFiles, threadExecutor->_processedSize, threadExecutor->_totalFileSize);
LeaveCriticalSection(&threadExecutor->_reportSync);
}
LeaveCriticalSection(&threadExecutor->_fileSync);
};
#ifdef _MSC_VER
#pragma warning(push)

View File

@ -1154,7 +1154,7 @@ void CheckBufferOverrun::checkGlobalAndLocalVariable()
}
/** @todo false negatives: this may be too conservative */
if (!var || var->typeEndToken()->str() != "*" || var->typeStartToken()->next() != var->typeEndToken())
if (!var || !var->isPointer() || var->typeStartToken()->next() != var->typeEndToken())
continue;
// get name of variable