summaryrefslogtreecommitdiff
path: root/apt-pkg/pkgcache.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2010-03-30 12:39:33 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2010-03-30 12:39:33 +0200
commitc408e01e546e641a0906f188ca6bb924a2f17b40 (patch)
tree19e3017200594d6d6ae0b3e68a1e3cc04815596d /apt-pkg/pkgcache.cc
parent6dc60370a750334cb701386cfa4ef9719db9078a (diff)
Group packages in the same group together in the package list
so it is easier to find them later on as we have no "noice" anymore between them.
Diffstat (limited to 'apt-pkg/pkgcache.cc')
-rw-r--r--apt-pkg/pkgcache.cc17
1 files changed, 5 insertions, 12 deletions
diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc
index fe8757ded..1bbd74bd9 100644
--- a/apt-pkg/pkgcache.cc
+++ b/apt-pkg/pkgcache.cc
@@ -343,24 +343,17 @@ pkgCache::PkgIterator pkgCache::GrpIterator::FindPkg(string Arch) {
// GrpIterator::NextPkg - Locate the next package in the group /*{{{*/
// ---------------------------------------------------------------------
/* Returns an End-Pointer on error, pointer to the package otherwise.
- We can't simply ++ to the next as the list of packages includes
- "package noise" (= packages with the same hash value but different name) */
+ We can't simply ++ to the next as the next package of the last will
+ be from a different group (with the same hash value) */
pkgCache::PkgIterator pkgCache::GrpIterator::NextPkg(pkgCache::PkgIterator const &LastPkg) {
if (unlikely(IsGood() == false || S->FirstPackage == 0 ||
LastPkg.end() == true))
return PkgIterator(*Owner, 0);
- // Iterate over the list to find the next package
- pkgCache::Package *Pkg = Owner->PkgP + LastPkg.Index();
- Pkg = Owner->PkgP + Pkg->NextPackage;
- for (; Pkg != Owner->PkgP; Pkg = Owner->PkgP + Pkg->NextPackage) {
- if (S->Name == Pkg->Name)
- return PkgIterator(*Owner, Pkg);
- if ((Owner->PkgP + S->LastPackage) == Pkg)
- break;
- }
+ if (S->LastPackage == LastPkg.Index())
+ return PkgIterator(*Owner, 0);
- return PkgIterator(*Owner, 0);
+ return PkgIterator(*Owner, Owner->PkgP + LastPkg->NextPackage);
}
/*}}}*/
// GrpIterator::operator ++ - Postfix incr /*{{{*/