diff options
author | Julian Andres Klode <jak@debian.org> | 2020-01-09 09:55:30 +0000 |
---|---|---|
committer | Julian Andres Klode <jak@debian.org> | 2020-01-09 09:55:30 +0000 |
commit | cfeae24843e8357c7e8d2ff3b23ee81cac330017 (patch) | |
tree | 9f3cb77cb9728d427c882274fe78dd2e0a090cca /apt-pkg | |
parent | 84176f6cde1fda522a3aad21d8238c7bd603da87 (diff) | |
parent | 6902792898a9fcc3bdff605e2097e6a5cd2d6bbc (diff) |
Merge branch 'pu/source-groups' into 'master'
Avoid extra out-of-cache hash table deduplication for package names
See merge request apt-team/apt!92
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/deb/deblistparser.cc | 7 | ||||
-rw-r--r-- | apt-pkg/pkgcachegen.cc | 3 | ||||
-rw-r--r-- | apt-pkg/pkgcachegen.h | 5 |
3 files changed, 8 insertions, 7 deletions
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index 75fc2d242..88b41ad30 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -211,9 +211,12 @@ bool debListParser::NewVersion(pkgCache::VerIterator &Ver) } if (V.end() == true) { - map_stringitem_t const idx = StoreString(pkgCacheGenerator::PKGNAME, pkgname); + pkgCache::GrpIterator SG; + if (not NewGroup(SG, pkgname)) + return false; + G = Ver.ParentPkg().Group(); - Ver->SourcePkgName = idx; + Ver->SourcePkgName = SG->Name; } } } diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index 030f4df0a..183750acb 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -559,7 +559,7 @@ bool pkgCacheGenerator::NewGroup(pkgCache::GrpIterator &Grp, StringView Name) return false; Grp = pkgCache::GrpIterator(Cache, Cache.GrpP + Group); - map_stringitem_t const idxName = StoreString(PKGNAME, Name); + map_stringitem_t const idxName = WriteStringInMap(Name); if (unlikely(idxName == 0)) return false; Grp->Name = idxName; @@ -1336,7 +1336,6 @@ map_stringitem_t pkgCacheGenerator::StoreString(enum StringType const type, cons auto strings = &strMixed; switch(type) { case MIXED: strings = &strMixed; break; - case PKGNAME: strings = &strPkgNames; break; case VERSIONNUMBER: strings = &strVersions; break; case SECTION: strings = &strSections; break; default: _error->Fatal("Unknown enum type used for string storage of '%.*s'", Size, S); return 0; diff --git a/apt-pkg/pkgcachegen.h b/apt-pkg/pkgcachegen.h index 1f639c526..2db2237da 100644 --- a/apt-pkg/pkgcachegen.h +++ b/apt-pkg/pkgcachegen.h @@ -70,7 +70,6 @@ class APT_HIDDEN pkgCacheGenerator /*{{{*/ }; std::unordered_set<string_pointer, hash> strMixed; - std::unordered_set<string_pointer, hash> strPkgNames; std::unordered_set<string_pointer, hash> strVersions; std::unordered_set<string_pointer, hash> strSections; #endif @@ -124,7 +123,7 @@ class APT_HIDDEN pkgCacheGenerator /*{{{*/ public: - enum StringType { MIXED, PKGNAME, VERSIONNUMBER, SECTION }; + enum StringType { MIXED, VERSIONNUMBER, SECTION }; map_stringitem_t StoreString(StringType const type, const char * S, unsigned int const Size); inline map_stringitem_t StoreString(enum StringType const type, APT::StringView S) {return StoreString(type, S.data(),S.length());}; @@ -179,7 +178,7 @@ class APT_HIDDEN pkgCacheListParser void * const d; protected: - + inline bool NewGroup(pkgCache::GrpIterator &Grp, APT::StringView Name) { return Owner->NewGroup(Grp, Name); } inline map_stringitem_t StoreString(pkgCacheGenerator::StringType const type, const char *S,unsigned int Size) {return Owner->StoreString(type, S, Size);}; inline map_stringitem_t StoreString(pkgCacheGenerator::StringType const type, APT::StringView S) {return Owner->StoreString(type, S);}; inline map_stringitem_t WriteString(APT::StringView S) {return Owner->WriteStringInMap(S.data(), S.size());}; |