summaryrefslogtreecommitdiff
path: root/apt-pkg/depcache.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2022-04-01 13:45:09 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2022-04-01 14:16:19 +0200
commit472376be6818b5ea43250abcbecfcab53b4a729a (patch)
tree892879ac883236b867e058a82b7ca153b3c56fc4 /apt-pkg/depcache.cc
parent0b156cd1711a5e27643b941f5a321a62e5a9b628 (diff)
Use pkgTagSection::Key in more places in src:apt
The speed critical paths were converted earlier, but the remaining could benefit a tiny bit from this as well especially as we have the facility now available and can therefore brush up the code in various places in the process as well. Also takes the time to add the hidden Exists method advertised in the headers, but previously not implemented.
Diffstat (limited to 'apt-pkg/depcache.cc')
-rw-r--r--apt-pkg/depcache.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index f7d9832a0..a5b586f5b 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -23,6 +23,7 @@
#include <apt-pkg/prettyprinters.h>
#include <apt-pkg/progress.h>
#include <apt-pkg/strutl.h>
+#include <apt-pkg/tagfile-keys.h>
#include <apt-pkg/tagfile.h>
#include <apt-pkg/version.h>
#include <apt-pkg/versionmatch.h>
@@ -310,8 +311,8 @@ bool pkgDepCache::readStateFile(OpProgress * const Prog) /*{{{*/
off_t amt = 0;
bool const debug_autoremove = _config->FindB("Debug::pkgAutoRemove",false);
while(tagfile.Step(section)) {
- string const pkgname = section.FindS("Package");
- string pkgarch = section.FindS("Architecture");
+ auto const pkgname = section.Find(pkgTagSection::Key::Package);
+ auto pkgarch = section.Find(pkgTagSection::Key::Architecture);
if (pkgarch.empty() == true)
pkgarch = "any";
pkgCache::PkgIterator pkg = Cache->FindPkg(pkgname, pkgarch);
@@ -379,8 +380,8 @@ bool pkgDepCache::writeStateFile(OpProgress * const /*prog*/, bool const Install
pkgTagSection section;
std::set<string> pkgs_seen;
while(tagfile.Step(section)) {
- string const pkgname = section.FindS("Package");
- string pkgarch = section.FindS("Architecture");
+ auto const pkgname = section.Find(pkgTagSection::Key::Package);
+ auto pkgarch = section.Find(pkgTagSection::Key::Architecture);
if (pkgarch.empty() == true)
pkgarch = "native";
// Silently ignore unknown packages and packages with no actual