]> git.saurik.com Git - apt.git/commitdiff
packages in the cache are sorted by name so noise-free
authorDavid Kalnischkies <david@kalnischkies.de>
Thu, 19 Jun 2014 10:23:10 +0000 (12:23 +0200)
committerDavid Kalnischkies <david@kalnischkies.de>
Fri, 26 Sep 2014 22:09:22 +0000 (00:09 +0200)
Commit aa0fe657e46b87cc692895a36df12e8b74bb27bb sorts the package names
in the hashtable. We make use of this already in these functions, but as
a minor sideeffect it also means that we don't have 'noise' anymore
between packages belonging to the same group. We therefore don't need to
check for a matching name in Grp.FindPkg anymore.

Git-Dch: Ignore

apt-pkg/pkgcache.cc

index 467d15eae63692c1b5a2dae5bd4a066b9a3ab97c..4b4631a6500f018f36544ace6219e1ea4d8804ae 100644 (file)
@@ -276,9 +276,6 @@ pkgCache::GrpIterator pkgCache::FindGrp(const string &Name) {
        // Look at the hash bucket for the group
        Group *Grp = GrpP + HeaderP->GrpHashTable()[sHash(Name)];
        for (; Grp != GrpP; Grp = GrpP + Grp->Next) {
-               if (unlikely(Grp->Name == 0))
-                  continue;
-
                int const cmp = strcmp(Name.c_str(), StrP + Grp->Name);
                if (cmp == 0)
                        return GrpIterator(*this, Grp);
@@ -361,14 +358,10 @@ pkgCache::PkgIterator pkgCache::GrpIterator::FindPkg(string Arch) const {
                Arch = myArch;
        }
 
-       /* Iterate over the list to find the matching arch
-          unfortunately this list includes "package noise"
-          (= different packages with same calculated hash),
-          so we need to check the name also */
+       // Iterate over the list to find the matching arch
        for (pkgCache::Package *Pkg = PackageList(); Pkg != Owner->PkgP;
             Pkg = Owner->PkgP + Pkg->Next) {
-               if (S->Name == (Owner->GrpP + Pkg->Group)->Name &&
-                   stringcmp(Arch, Owner->StrP + Pkg->Arch) == 0)
+               if (stringcmp(Arch, Owner->StrP + Pkg->Arch) == 0)
                        return PkgIterator(*Owner, Pkg);
                if ((Owner->PkgP + S->LastPackage) == Pkg)
                        break;