summaryrefslogtreecommitdiff
path: root/ftparchive/apt-ftparchive.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2017-03-14 11:35:41 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2017-06-26 23:31:15 +0200
commitf78fb67f4b6a5673e497ba1aeb19568581173909 (patch)
treee4c25d36164ad232c04f4ab92256db593574c4da /ftparchive/apt-ftparchive.cc
parente1d727654c49567f134ea74acee7ec57e7940069 (diff)
Refactor to avoid loop/dangling gcc warnings
Gbp-Dch: Ignore
Diffstat (limited to 'ftparchive/apt-ftparchive.cc')
-rw-r--r--ftparchive/apt-ftparchive.cc12
1 files changed, 4 insertions, 8 deletions
diff --git a/ftparchive/apt-ftparchive.cc b/ftparchive/apt-ftparchive.cc
index ab6f48d61..9c02e5b87 100644
--- a/ftparchive/apt-ftparchive.cc
+++ b/ftparchive/apt-ftparchive.cc
@@ -1002,7 +1002,7 @@ static bool Clean(CommandLine &CmdL)
stable_sort(PkgList.begin(),PkgList.end(),PackageMap::SrcDBCompare());
string CacheDir = Setup.FindDir("Dir::CacheDir");
-
+
for (vector<PackageMap>::iterator I = PkgList.begin(); I != PkgList.end(); )
{
if(I->BinCacheDB != "")
@@ -1016,15 +1016,11 @@ static bool Clean(CommandLine &CmdL)
if (DB_SRC.Clean() == false)
_error->DumpErrors();
- string CacheDB = I->BinCacheDB;
- string SrcCacheDB = I->SrcCacheDB;
- while(I != PkgList.end() &&
- I->BinCacheDB == CacheDB &&
- I->SrcCacheDB == SrcCacheDB)
- ++I;
+ I = std::find_if(I, PkgList.end(),
+ [&](PackageMap const &PM) { return PM.BinCacheDB != I->BinCacheDB || PM.SrcCacheDB != I->SrcCacheDB;
+ });
}
-
return true;
}
/*}}}*/