summaryrefslogtreecommitdiff
path: root/apt-pkg/pkgcache.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2016-01-08 11:12:14 +0100
committerJulian Andres Klode <jak@debian.org>2016-01-08 21:20:25 +0100
commit60d523e2ae93a6c5bc396b6bede2544271fb1f2e (patch)
tree949bac3513d69f66d7df6dbc92afca564b2eb8b6 /apt-pkg/pkgcache.cc
parentaf4899c9df6e925b1cb099c29bd78788b2984cca (diff)
Store the size of strings in the cache
By storing the size of the string in the cache, we can make use of it when comparing the names in the hashtable in pkgCache::FindGrp.
Diffstat (limited to 'apt-pkg/pkgcache.cc')
-rw-r--r--apt-pkg/pkgcache.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc
index f4fb073f5..d2ecb8b1f 100644
--- a/apt-pkg/pkgcache.cc
+++ b/apt-pkg/pkgcache.cc
@@ -59,7 +59,7 @@ pkgCache::Header::Header()
/* Whenever the structures change the major version should be bumped,
whenever the generator changes the minor version should be bumped. */
APT_HEADER_SET(MajorVersion, 10);
- APT_HEADER_SET(MinorVersion, 3);
+ APT_HEADER_SET(MinorVersion, 4);
APT_HEADER_SET(Dirty, false);
APT_HEADER_SET(HeaderSz, sizeof(pkgCache::Header));
@@ -307,7 +307,7 @@ pkgCache::GrpIterator pkgCache::FindGrp(StringView Name) {
// Look at the hash bucket for the group
Group *Grp = GrpP + HeaderP->GrpHashTableP()[sHash(Name)];
for (; Grp != GrpP; Grp = GrpP + Grp->Next) {
- int const cmp = Name.compare(StrP + Grp->Name);
+ int const cmp = Name.compare(ViewString(Grp->Name));
if (cmp == 0)
return GrpIterator(*this, Grp);
else if (cmp < 0)
@@ -389,7 +389,7 @@ pkgCache::PkgIterator pkgCache::GrpIterator::FindPkg(StringView Arch) const {
// Iterate over the list to find the matching arch
for (pkgCache::Package *Pkg = PackageList(); Pkg != Owner->PkgP;
Pkg = Owner->PkgP + Pkg->NextPackage) {
- if (Arch.compare(Owner->StrP + Pkg->Arch) == 0)
+ if (Arch == Owner->ViewString(Pkg->Arch))
return PkgIterator(*Owner, Pkg);
if ((Owner->PkgP + S->LastPackage) == Pkg)
break;