diff options
| author | David Kalnischkies <david@kalnischkies.de> | 2022-04-01 13:45:09 +0200 |
|---|---|---|
| committer | David Kalnischkies <david@kalnischkies.de> | 2022-04-01 14:16:19 +0200 |
| commit | 472376be6818b5ea43250abcbecfcab53b4a729a (patch) | |
| tree | 892879ac883236b867e058a82b7ca153b3c56fc4 /apt-pkg/policy.cc | |
| parent | 0b156cd1711a5e27643b941f5a321a62e5a9b628 (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/policy.cc')
| -rw-r--r-- | apt-pkg/policy.cc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/apt-pkg/policy.cc b/apt-pkg/policy.cc index c5328c517..b30eddb37 100644 --- a/apt-pkg/policy.cc +++ b/apt-pkg/policy.cc @@ -21,7 +21,9 @@ #include <apt-pkg/fileutl.h> #include <apt-pkg/pkgcache.h> #include <apt-pkg/policy.h> +#include <apt-pkg/string_view.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> @@ -425,12 +427,12 @@ bool ReadPinFile(pkgPolicy &Plcy,string File) if (Tags.Count() == 0) continue; - string Name = Tags.FindS("Package"); - if (Name.empty() == true) + auto Name = Tags.Find(pkgTagSection::Key::Package); + if (Name.empty()) return _error->Error(_("Invalid record in the preferences file %s, no Package header"), File.c_str()); if (Name == "*") - Name = string(); - + Name = APT::StringView{}; + const char *Start; const char *End; if (Tags.Find("Pin",Start,End) == false) @@ -479,7 +481,7 @@ bool ReadPinFile(pkgPolicy &Plcy,string File) return _error->Error(_("No priority (or zero) specified for pin")); } - istringstream s(Name); + std::istringstream s(Name.to_string()); string pkg; while(!s.eof()) { |
