diff options
author | David Kalnischkies <david@kalnischkies.de> | 2019-09-13 12:01:47 +0200 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2019-11-26 12:36:46 +0100 |
commit | 35012abf30ec1cfc9b5ee29647d4b1e25d98e99f (patch) | |
tree | ef2db5018db5878c4fc467bbcaabaac911831c3f /apt-pkg/contrib/configuration.cc | |
parent | fe3627d769006a223ff65afff52a21d9ba479cdf (diff) |
Fix some style warnings from cppcheck
Unused variable, std::algorithms instead of raw for-loops.
There should be no observeable difference in behaviour.
Reported-By: cppcheck
Gbp-Dch: Ignore
Diffstat (limited to 'apt-pkg/contrib/configuration.cc')
-rw-r--r-- | apt-pkg/contrib/configuration.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc index 997ef7423..931df9f6c 100644 --- a/apt-pkg/contrib/configuration.cc +++ b/apt-pkg/contrib/configuration.cc @@ -32,6 +32,7 @@ #include <algorithm> #include <fstream> #include <iterator> +#include <numeric> #include <sstream> #include <stack> #include <string> @@ -1149,10 +1150,10 @@ bool ReadConfigFile(Configuration &Conf,const string &FName,bool const &AsSectio bool ReadConfigDir(Configuration &Conf,const string &Dir, bool const &AsSectional, unsigned const &Depth) { - bool good = true; - for (auto const &I : GetListOfFilesInDir(Dir, "conf", true, true)) - good = ReadConfigFile(Conf, I, AsSectional, Depth) && good; - return good; + auto const files = GetListOfFilesInDir(Dir, "conf", true, true); + return std::accumulate(files.cbegin(), files.cend(), true, [&](bool good, auto const &file) { + return ReadConfigFile(Conf, file, AsSectional, Depth) && good; + }); } /*}}}*/ // MatchAgainstConfig Constructor /*{{{*/ |