diff options
author | Julian Andres Klode <jak@debian.org> | 2016-01-08 11:12:14 +0100 |
---|---|---|
committer | Julian Andres Klode <jak@debian.org> | 2016-01-08 21:20:25 +0100 |
commit | 60d523e2ae93a6c5bc396b6bede2544271fb1f2e (patch) | |
tree | 949bac3513d69f66d7df6dbc92afca564b2eb8b6 /apt-pkg/pkgcache.h | |
parent | af4899c9df6e925b1cb099c29bd78788b2984cca (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.h')
-rw-r--r-- | apt-pkg/pkgcache.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h index 9fea44e06..91228f713 100644 --- a/apt-pkg/pkgcache.h +++ b/apt-pkg/pkgcache.h @@ -245,6 +245,16 @@ class pkgCache /*{{{*/ APT_HIDDEN PkgIterator FindPkg(APT::StringView Name, APT::StringView Arch); #endif +#ifdef APT_PKG_EXPOSE_STRING_VIEW + APT::StringView ViewString(map_stringitem_t idx) const + { + char *name = StrP + idx; + uint16_t len = *reinterpret_cast<const uint16_t*>(name - sizeof(uint16_t)); + return APT::StringView(name, len); + } +#endif + + GrpIterator FindGrp(const std::string &Name); PkgIterator FindPkg(const std::string &Name); PkgIterator FindPkg(const std::string &Name, const std::string &Arch); |