From fd23676e809b7fa87ae138cc22d2c683d212950e Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 13 Jul 2015 12:47:05 +0200 Subject: bunch of micro-optimizations for depcache DepCache functions are called a lot, so if we can squeeze some drops out of them for free we should do so. Takes also the opportunity to remove some whitespace errors from these functions. Git-Dch: Ignore --- apt-pkg/pkgcache.cc | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'apt-pkg/pkgcache.cc') diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index aebbffe8b..897f1ee2a 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -697,29 +697,34 @@ void pkgCache::DepIterator::GlobOr(DepIterator &Start,DepIterator &End) // --------------------------------------------------------------------- /* Deps like self-conflicts should be ignored as well as implicit conflicts on virtual packages. */ -bool pkgCache::DepIterator::IsIgnorable(PkgIterator const &/*Pkg*/) const +bool pkgCache::DepIterator::IsIgnorable(PkgIterator const &PT) const { if (IsNegative() == false) return false; - pkgCache::PkgIterator PP = ParentPkg(); - pkgCache::PkgIterator PT = TargetPkg(); + pkgCache::PkgIterator const PP = ParentPkg(); if (PP->Group != PT->Group) return false; // self-conflict if (PP == PT) return true; - pkgCache::VerIterator PV = ParentVer(); + pkgCache::VerIterator const PV = ParentVer(); // ignore group-conflict on a M-A:same package - but not our implicit dependencies // so that we can have M-A:same packages conflicting with their own real name if ((PV->MultiArch & pkgCache::Version::Same) == pkgCache::Version::Same) { // Replaces: ${self}:other ( << ${binary:Version}) - if (S->Type == pkgCache::Dep::Replaces && S->CompareOp == pkgCache::Dep::Less && strcmp(PV.VerStr(), TargetVer()) == 0) - return false; + if (S->Type == pkgCache::Dep::Replaces) + { + if (S->CompareOp == pkgCache::Dep::Less && strcmp(PV.VerStr(), TargetVer()) == 0) + return false; + } // Breaks: ${self}:other (!= ${binary:Version}) - if (S->Type == pkgCache::Dep::DpkgBreaks && S->CompareOp == pkgCache::Dep::NotEquals && strcmp(PV.VerStr(), TargetVer()) == 0) - return false; + else if (S->Type == pkgCache::Dep::DpkgBreaks) + { + if (S->CompareOp == pkgCache::Dep::NotEquals && strcmp(PV.VerStr(), TargetVer()) == 0) + return false; + } return true; } -- cgit v1.2.3