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:
parent
d019b7f9a6
commit
fd2f93bb80
|
@ -422,12 +422,7 @@ unsigned int __stdcall ThreadExecutor::threadProc(void *args)
|
||||||
CppCheck fileChecker(*threadExecutor, false);
|
CppCheck fileChecker(*threadExecutor, false);
|
||||||
fileChecker.settings() = threadExecutor->_settings;
|
fileChecker.settings() = threadExecutor->_settings;
|
||||||
|
|
||||||
LeaveCriticalSection(&threadExecutor->_fileSync);
|
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
|
||||||
EnterCriticalSection(&threadExecutor->_fileSync);
|
|
||||||
|
|
||||||
if (it == threadExecutor->_files.end()) {
|
if (it == threadExecutor->_files.end()) {
|
||||||
LeaveCriticalSection(&threadExecutor->_fileSync);
|
LeaveCriticalSection(&threadExecutor->_fileSync);
|
||||||
return result;
|
return result;
|
||||||
|
@ -457,8 +452,6 @@ unsigned int __stdcall ThreadExecutor::threadProc(void *args)
|
||||||
CppCheckExecutor::reportStatus(threadExecutor->_processedFiles, threadExecutor->_totalFiles, threadExecutor->_processedSize, threadExecutor->_totalFileSize);
|
CppCheckExecutor::reportStatus(threadExecutor->_processedFiles, threadExecutor->_totalFiles, threadExecutor->_processedSize, threadExecutor->_totalFileSize);
|
||||||
LeaveCriticalSection(&threadExecutor->_reportSync);
|
LeaveCriticalSection(&threadExecutor->_reportSync);
|
||||||
}
|
}
|
||||||
|
|
||||||
LeaveCriticalSection(&threadExecutor->_fileSync);
|
|
||||||
};
|
};
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
|
|
|
@ -1154,7 +1154,7 @@ void CheckBufferOverrun::checkGlobalAndLocalVariable()
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @todo false negatives: this may be too conservative */
|
/** @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;
|
continue;
|
||||||
|
|
||||||
// get name of variable
|
// get name of variable
|
||||||
|
|
Loading…
Reference in New Issue