From 8dd562a894c2472e3705fe13c212f665b55744a9 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 29 Aug 2015 12:28:24 +0200 Subject: use c++11 algorithms to avoid strange compiler warnings Nobody knows what makes the 'unable to optimize loop' warning to appear in the sourceslist minus-options parsing, especially if we use a foreach loop, but we can replace it with some nice c++11 algorithm+lambda usage, which also helps in making even clearer what happens here. And as this would be a lonely change, lets do it for a few more loops as well where I might or might not have seen the warning at some point in time, too. Git-Dch: Ignore --- apt-pkg/cacheset.cc | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'apt-pkg/cacheset.cc') diff --git a/apt-pkg/cacheset.cc b/apt-pkg/cacheset.cc index 6a625184e..6b31a4fff 100644 --- a/apt-pkg/cacheset.cc +++ b/apt-pkg/cacheset.cc @@ -153,12 +153,8 @@ bool CacheSetHelper::PackageFromRegEx(PackageContainerInterface * const pci, pkg continue; pkgCache::PkgIterator Pkg = Grp.FindPkg(arch); if (Pkg.end() == true) { - if (archfound == std::string::npos) { - std::vector archs = APT::Configuration::getArchitectures(); - for (std::vector::const_iterator a = archs.begin(); - a != archs.end() && Pkg.end() != true; ++a) - Pkg = Grp.FindPkg(*a); - } + if (archfound == std::string::npos) + Pkg = Grp.FindPreferredPkg(true); if (Pkg.end() == true) continue; } @@ -213,12 +209,8 @@ bool CacheSetHelper::PackageFromFnmatch(PackageContainerInterface * const pci, continue; pkgCache::PkgIterator Pkg = Grp.FindPkg(arch); if (Pkg.end() == true) { - if (archfound == std::string::npos) { - std::vector archs = APT::Configuration::getArchitectures(); - for (std::vector::const_iterator a = archs.begin(); - a != archs.end() && Pkg.end() != true; ++a) - Pkg = Grp.FindPkg(*a); - } + if (archfound == std::string::npos) + Pkg = Grp.FindPreferredPkg(true); if (Pkg.end() == true) continue; } -- cgit v1.2.3