From 4668e19060394f2a04dd91aec27022c743fb16d1 Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Thu, 13 Jan 2011 23:18:04 +0200 Subject: [PATCH] Modify Cppcheck::addFile() only take one file as a parameter. CLI and GUI already do the directory walking for us and we have list of files to check. So we were duplicating this directory walking. Practically doing check again for each file if it is a directory. Which can take some time with large amount of files. --- lib/cppcheck.cpp | 6 +++--- lib/cppcheck.h | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/cppcheck.cpp b/lib/cppcheck.cpp index fb2bebb6f..c2711bd60 100644 --- a/lib/cppcheck.cpp +++ b/lib/cppcheck.cpp @@ -56,14 +56,14 @@ void CppCheck::settings(const Settings ¤tSettings) _settings = currentSettings; } -void CppCheck::addFile(const std::string &path) +void CppCheck::addFile(const std::string &filepath) { - getFileLister()->recursiveAddFiles(_filenames, path.c_str()); + _filenames.push_back(Path::fromNativeSeparators(filepath)); } void CppCheck::addFile(const std::string &path, const std::string &content) { - _filenames.push_back(path); + _filenames.push_back(Path::fromNativeSeparators(path)); _fileContents[ path ] = content; } diff --git a/lib/cppcheck.h b/lib/cppcheck.h index 18a81d1db..8d8417c83 100644 --- a/lib/cppcheck.h +++ b/lib/cppcheck.h @@ -77,10 +77,8 @@ public: * @param path Relative or absolute path to the file to be checked, * e.g. "cppcheck.cpp". Note that only source files (.c, .cc or .cpp) * should be added to the list. Include files are gathered automatically. - * You can also give path, e.g. "src/" which will be scanned for source - * files recursively. */ - void addFile(const std::string &path); + void addFile(const std::string &filepath); /** * @brief Add new unreal file to be checked.