From 4940da06c02736aebd3c2201ec863a9faac14d77 Mon Sep 17 00:00:00 2001 From: PKEuS Date: Fri, 5 Sep 2014 11:05:21 +0200 Subject: [PATCH] Calculate checksum only if necessary (#6129) --- lib/cppcheck.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/cppcheck.cpp b/lib/cppcheck.cpp index d82ad435e..cf68d8fc1 100644 --- a/lib/cppcheck.cpp +++ b/lib/cppcheck.cpp @@ -360,10 +360,12 @@ bool CppCheck::checkFile(const std::string &code, const char FileName[], std::se result = _tokenizer.tokenize(istr, FileName, cfg); timer.Stop(); - unsigned long long checksum = _tokenizer.list.calculateChecksum(); - if (checksums.find(checksum) != checksums.end()) - return false; - checksums.insert(checksum); + if (_settings._force || _settings._maxConfigs > 1) { + unsigned long long checksum = _tokenizer.list.calculateChecksum(); + if (checksums.find(checksum) != checksums.end()) + return false; + checksums.insert(checksum); + } if (!result) { // File had syntax errors, abort