From d4b0ddee41860a802e8d254f7e222c863592aaea Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 26 Feb 2020 14:42:35 +0100 Subject: cache: Swap locations of hashtables, hide them from non-apt users Only expose the locations of the hasthables if APT_COMPILING_APT is set. --- apt-pkg/pkgcache.h | 7 +++++-- 1 file 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 * PkgHashTableP() const { return (map_pointer*) (this + 1); } - map_pointer * GrpHashTableP() const { return reinterpret_cast *>(PkgHashTableP() + GetHashTableSize()); } + +#ifdef APT_COMPILING_APT + map_pointer * GrpHashTableP() const { return (map_pointer*) (this + 1); } + map_pointer * PkgHashTableP() const { return reinterpret_cast *>(GrpHashTableP() + GetHashTableSize()); } +#endif /** \brief Hash of the file (TODO: Rename) */ map_filesize_small_t CacheFileSize; -- cgit v1.2.3