Просмотр исходного кода

packages in the cache are sorted by name so noise-free

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
David Kalnischkies лет назад: 12
Родитель
Сommit
5d1e330d8b
1 измененных файлов с 2 добавлено и 9 удалено
  1. 2 9
      apt-pkg/pkgcache.cc

+ 2 - 9
apt-pkg/pkgcache.cc

@@ -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;