summaryrefslogtreecommitdiff
path: root/apt-private
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-private
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-private')
-rw-r--r--apt-private/private-show.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/apt-private/private-show.cc b/apt-private/private-show.cc
index b56b87d67..46c4c35e7 100644
--- a/apt-private/private-show.cc
+++ b/apt-private/private-show.cc
@@ -17,6 +17,7 @@
#include <apt-pkg/policy.h>
#include <apt-pkg/sourcelist.h>
#include <apt-pkg/strutl.h>
+#include <apt-pkg/tagfile-keys.h>
#include <apt-pkg/tagfile.h>
#include <apt-private/private-cacheset.h>
@@ -233,13 +234,15 @@ static bool DisplayRecordV2(pkgCacheFile &CacheFile, pkgRecords &Recs, /*{{{*/
// make size nice
std::string installed_size;
- if (Tags.FindULL("Installed-Size") > 0)
- strprintf(installed_size, "%sB", SizeToStr(Tags.FindULL("Installed-Size") * 1024).c_str());
+ auto const installed_size_field = Tags.FindULL(pkgTagSection::Key::Installed_Size);
+ if (installed_size_field > 0)
+ installed_size = SizeToStr(installed_size_field * 1024).append("B");
else
installed_size = _("unknown");
std::string package_size;
- if (Tags.FindULL("Size") > 0)
- strprintf(package_size, "%sB", SizeToStr(Tags.FindULL("Size")).c_str());
+ auto const package_size_field = Tags.FindULL(pkgTagSection::Key::Size);
+ if (package_size_field > 0)
+ package_size = SizeToStr(package_size_field).append("B");
else
package_size = _("unknown");