summaryrefslogtreecommitdiff
path: root/cmdline
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2019-07-08 15:48:59 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2019-07-08 15:51:17 +0200
commit2b734a7ec429825c7007c1093883229e069d36c7 (patch)
treeb67360f3201634c82f5a9e7dd84f47b28fa63acb /cmdline
parentcbe90ee516d7f747f981e423f164f99eb767240b (diff)
Apply various suggestions by cppcheck
Reported-By: cppcheck
Diffstat (limited to 'cmdline')
-rw-r--r--cmdline/apt-cache.cc15
-rw-r--r--cmdline/apt-extracttemplates.cc2
-rw-r--r--cmdline/apt-get.cc7
-rw-r--r--cmdline/apt-helper.cc2
-rw-r--r--cmdline/apt-internal-solver.cc1
5 files changed, 12 insertions, 15 deletions
diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc
index 499c9edc9..acf00bdda 100644
--- a/cmdline/apt-cache.cc
+++ b/cmdline/apt-cache.cc
@@ -136,12 +136,12 @@ static bool DumpPackage(CommandLine &CmdL)
/* */
static map_pointer_t PackageNext(pkgCache::Package const * const P) { return P->NextPackage; }
static map_pointer_t GroupNext(pkgCache::Group const * const G) { return G->Next; }
-template<class T>
-static void ShowHashTableStats(std::string Type,
- T *StartP,
- map_pointer_t *Hashtable,
- unsigned long Size,
- map_pointer_t(*Next)(T const * const))
+template <class T>
+static void ShowHashTableStats(char const *const Type,
+ T *StartP,
+ map_pointer_t *Hashtable,
+ unsigned long Size,
+ map_pointer_t (*Next)(T const *const))
{
// hashtable stats for the HashTable
unsigned long NumBuckets = Size;
@@ -201,8 +201,7 @@ static bool Stats(CommandLine &CmdL)
int NVirt = 0;
int DVirt = 0;
int Missing = 0;
- pkgCache::PkgIterator I = Cache->PkgBegin();
- for (;I.end() != true; ++I)
+ for (pkgCache::PkgIterator I = Cache->PkgBegin(); I.end() != true; ++I)
{
if (I->VersionList != 0 && I->ProvidesList == 0)
{
diff --git a/cmdline/apt-extracttemplates.cc b/cmdline/apt-extracttemplates.cc
index bc8a27dbe..01b5dbb11 100644
--- a/cmdline/apt-extracttemplates.cc
+++ b/cmdline/apt-extracttemplates.cc
@@ -326,7 +326,7 @@ static std::vector<aptDispatchWithHelp> GetCommands() /*{{{*/
int main(int argc, const char **argv) /*{{{*/
{
CommandLine CmdL;
- auto const Cmds = ParseCommandLine(CmdL, APT_CMD::APT_EXTRACTTEMPLATES, &_config, &_system, argc, argv, &ShowHelp, &GetCommands);
+ ParseCommandLine(CmdL, APT_CMD::APT_EXTRACTTEMPLATES, &_config, &_system, argc, argv, &ShowHelp, &GetCommands);
Go(CmdL);
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index 7ef07fbf0..5d81c08a4 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -148,8 +148,7 @@ static bool DoDSelectUpgrade(CommandLine &)
pkgDepCache::ActionGroup group(Cache);
// Install everything with the install flag set
- pkgCache::PkgIterator I = Cache->PkgBegin();
- for (;I.end() != true; ++I)
+ for (pkgCache::PkgIterator I = Cache->PkgBegin(); I.end() != true; ++I)
{
/* Install the package only if it is a new install, the autoupgrader
will deal with the rest */
@@ -159,7 +158,7 @@ static bool DoDSelectUpgrade(CommandLine &)
/* Now install their deps too, if we do this above then order of
the status file is significant for | groups */
- for (I = Cache->PkgBegin();I.end() != true; ++I)
+ for (pkgCache::PkgIterator I = Cache->PkgBegin(); I.end() != true; ++I)
{
/* Install the package only if it is a new install, the autoupgrader
will deal with the rest */
@@ -168,7 +167,7 @@ static bool DoDSelectUpgrade(CommandLine &)
}
// Apply erasures now, they override everything else.
- for (I = Cache->PkgBegin();I.end() != true; ++I)
+ for (pkgCache::PkgIterator I = Cache->PkgBegin(); I.end() != true; ++I)
{
// Remove packages
if (I->SelectedState == pkgCache::State::DeInstall ||
diff --git a/cmdline/apt-helper.cc b/cmdline/apt-helper.cc
index 119cbc4c8..e52fba39f 100644
--- a/cmdline/apt-helper.cc
+++ b/cmdline/apt-helper.cc
@@ -133,7 +133,7 @@ static bool DoSrvLookup(CommandLine &CmdL) /*{{{*/
return true;
}
/*}}}*/
-static const APT::Configuration::Compressor *FindCompressor(std::vector<APT::Configuration::Compressor> const & compressors, std::string name) /*{{{*/
+static const APT::Configuration::Compressor *FindCompressor(std::vector<APT::Configuration::Compressor> const &compressors, std::string const &name) /*{{{*/
{
APT::Configuration::Compressor const * compressor = NULL;
for (auto const & c : compressors)
diff --git a/cmdline/apt-internal-solver.cc b/cmdline/apt-internal-solver.cc
index 5c9ca5a35..d22eb75b4 100644
--- a/cmdline/apt-internal-solver.cc
+++ b/cmdline/apt-internal-solver.cc
@@ -67,7 +67,6 @@ static bool WriteSolution(pkgDepCache &Cache, FileFd &output) /*{{{*/
bool Okay = output.Failed() == false;
for (pkgCache::PkgIterator Pkg = Cache.PkgBegin(); Pkg.end() == false && likely(Okay); ++Pkg)
{
- std::string action;
if (Cache[Pkg].Delete() == true)
Okay &= EDSP::WriteSolutionStanza(output, "Remove", Pkg.CurrentVer());
else if (Cache[Pkg].NewInstall() == true || Cache[Pkg].Upgrade() == true)