summaryrefslogtreecommitdiff
path: root/apt-pkg/pkgcache.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2015-07-13 12:47:05 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2015-08-10 17:27:18 +0200
commitfd23676e809b7fa87ae138cc22d2c683d212950e (patch)
treeb11da2587ec5bd22b1013f087c46f114f8d53d24 /apt-pkg/pkgcache.cc
parent3707fd4faab3f2e2521263070b68fd0afaae2900 (diff)
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
Diffstat (limited to 'apt-pkg/pkgcache.cc')
-rw-r--r--apt-pkg/pkgcache.cc21
1 files changed, 13 insertions, 8 deletions
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;
}