summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2020-02-26 14:42:35 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2020-02-26 14:42:35 +0100
commitd4b0ddee41860a802e8d254f7e222c863592aaea (patch)
treedaa6cce4353c814707e073d8ad4cdaabd041739b
parent43b418a68d8e64b4f0220e730ccf7441e2796ea6 (diff)
cache: Swap locations of hashtables, hide them from non-apt users
Only expose the locations of the hasthables if APT_COMPILING_APT is set.
-rw-r--r--apt-pkg/pkgcache.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h
index f68736ddc..54b4319fb 100644
--- a/apt-pkg/pkgcache.h
+++ b/apt-pkg/pkgcache.h
@@ -386,8 +386,11 @@ struct pkgCache::Header
void SetHashTableSize(unsigned int const sz) { HashTableSize = sz; }
map_stringitem_t GetArchitectures() const { return Architectures; }
void SetArchitectures(map_stringitem_t const idx) { Architectures = idx; }
- map_pointer<Package> * PkgHashTableP() const { return (map_pointer<Package>*) (this + 1); }
- map_pointer<Group> * GrpHashTableP() const { return reinterpret_cast<map_pointer<Group> *>(PkgHashTableP() + GetHashTableSize()); }
+
+#ifdef APT_COMPILING_APT
+ map_pointer<Group> * GrpHashTableP() const { return (map_pointer<Group>*) (this + 1); }
+ map_pointer<Package> * PkgHashTableP() const { return reinterpret_cast<map_pointer<Package> *>(GrpHashTableP() + GetHashTableSize()); }
+#endif
/** \brief Hash of the file (TODO: Rename) */
map_filesize_small_t CacheFileSize;