summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2014-06-18 10:13:01 +0200
committerMichael Vogt <mvo@debian.org>2014-06-18 10:13:01 +0200
commitda029b0aaebdc64a3a9f6b7012213539421c934b (patch)
tree81ea34b4e10c9428c375fa3aaa21b831d69fcfe2 /apt-pkg
parentaa0bd601ea3db281187275bbbece760d85ff29d9 (diff)
parent637c3b232223c17827a8842cb1c24655469329ba (diff)
Merge remote-tracking branch 'mvo/feature/hash-stats' into debian/experimental
Conflicts: apt-pkg/acquire-item.cc apt-pkg/acquire-item.h apt-pkg/deb/debmetaindex.h apt-pkg/pkgcache.cc test/integration/test-apt-ftparchive-src-cachedb
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/pkgcache.cc12
-rw-r--r--apt-pkg/pkgcache.h6
-rw-r--r--apt-pkg/pkgcachegen.cc8
3 files changed, 11 insertions, 15 deletions
diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc
index 2b6153634..4fbdc93d5 100644
--- a/apt-pkg/pkgcache.cc
+++ b/apt-pkg/pkgcache.cc
@@ -55,11 +55,7 @@ pkgCache::Header::Header()
/* Whenever the structures change the major version should be bumped,
whenever the generator changes the minor version should be bumped. */
MajorVersion = 9;
-#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
MinorVersion = 2;
-#else
- MinorVersion = 1;
-#endif
Dirty = false;
HeaderSz = sizeof(pkgCache::Header);
@@ -218,7 +214,7 @@ pkgCache::PkgIterator pkgCache::SingleArchFindPkg(const string &Name)
{
// Look at the hash bucket
Package *Pkg = PkgP + HeaderP->PkgHashTable[Hash(Name)];
- for (; Pkg != PkgP; Pkg = PkgP + Pkg->NextPackage)
+ for (; Pkg != PkgP; Pkg = PkgP + Pkg->Next)
{
if (unlikely(Pkg->Name == 0))
continue;
@@ -374,7 +370,7 @@ pkgCache::PkgIterator pkgCache::GrpIterator::FindPkg(string Arch) const {
(= different packages with same calculated hash),
so we need to check the name also */
for (pkgCache::Package *Pkg = PackageList(); Pkg != Owner->PkgP;
- Pkg = Owner->PkgP + Pkg->NextPackage) {
+ Pkg = Owner->PkgP + Pkg->Next) {
if (S->Name == Pkg->Name &&
stringcasecmp(Arch, Owner->StrP + Pkg->Arch) == 0)
return PkgIterator(*Owner, Pkg);
@@ -423,7 +419,7 @@ pkgCache::PkgIterator pkgCache::GrpIterator::NextPkg(pkgCache::PkgIterator const
if (S->LastPackage == LastPkg.Index())
return PkgIterator(*Owner, 0);
- return PkgIterator(*Owner, Owner->PkgP + LastPkg->NextPackage);
+ return PkgIterator(*Owner, Owner->PkgP + LastPkg->Next);
}
/*}}}*/
// GrpIterator::operator ++ - Postfix incr /*{{{*/
@@ -450,7 +446,7 @@ void pkgCache::PkgIterator::operator ++(int)
{
// Follow the current links
if (S != Owner->PkgP)
- S = Owner->PkgP + S->NextPackage;
+ S = Owner->PkgP + S->Next;
// Follow the hash table
while (S == Owner->PkgP && (HashIndex+1) < (signed)_count(Owner->HeaderP->PkgHashTable))
diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h
index 22dc6218c..55f0187f9 100644
--- a/apt-pkg/pkgcache.h
+++ b/apt-pkg/pkgcache.h
@@ -316,8 +316,8 @@ struct pkgCache::Header
these packages are stored as a sequence in the list.
Beware: The Hashmethod assumes that the hash table sizes are equal */
- map_ptrloc PkgHashTable[2*1048];
- map_ptrloc GrpHashTable[2*1048];
+ map_ptrloc PkgHashTable[64*1048];
+ map_ptrloc GrpHashTable[64*1048];
/** \brief Size of the complete cache file */
unsigned long CacheFileSize;
@@ -390,7 +390,7 @@ struct pkgCache::Package
// Linked list
/** \brief Link to the next package in the same bucket */
- map_ptrloc NextPackage; // Package
+ map_ptrloc Next; // Package
/** \brief List of all dependencies on this package */
map_ptrloc RevDepends; // Dependency
/** \brief List of all "packages" this package provide */
diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc
index ac1cea0eb..9615b4c22 100644
--- a/apt-pkg/pkgcachegen.cc
+++ b/apt-pkg/pkgcachegen.cc
@@ -656,16 +656,16 @@ bool pkgCacheGenerator::NewPackage(pkgCache::PkgIterator &Pkg,const string &Name
unsigned long const Hash = Cache.Hash(Name);
map_ptrloc *insertAt = &Cache.HeaderP->PkgHashTable[Hash];
while (*insertAt != 0 && strcasecmp(Name.c_str(), Cache.StrP + (Cache.PkgP + *insertAt)->Name) > 0)
- insertAt = &(Cache.PkgP + *insertAt)->NextPackage;
- Pkg->NextPackage = *insertAt;
+ insertAt = &(Cache.PkgP + *insertAt)->Next;
+ Pkg->Next = *insertAt;
*insertAt = Package;
}
else // Group the Packages together
{
// this package is the new last package
pkgCache::PkgIterator LastPkg(Cache, Cache.PkgP + Grp->LastPackage);
- Pkg->NextPackage = LastPkg->NextPackage;
- LastPkg->NextPackage = Package;
+ Pkg->Next = LastPkg->Next;
+ LastPkg->Next = Package;
}
Grp->LastPackage = Package;