From fc2055e1e08e4e3b662b0c5f67a0d0a57267acd3 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 4 Jun 2017 18:14:13 +0200 Subject: avoid explicit types for pkg counts by auto Changes nothing on the program front and as the datatypes are sufficently comparable fixes no bug either, but problems later on if we ever change the types of those and prevent us using types which are too large for the values we want to store waste (a tiny bit of) resources. Gbp-Dch: Ignore --- apt-pkg/policy.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'apt-pkg/policy.cc') diff --git a/apt-pkg/policy.cc b/apt-pkg/policy.cc index 3dd6ddac4..e87ba3ee2 100644 --- a/apt-pkg/policy.cc +++ b/apt-pkg/policy.cc @@ -50,12 +50,14 @@ pkgPolicy::pkgPolicy(pkgCache *Owner) : Pins(nullptr), VerPins(nullptr), if (Owner == 0) return; PFPriority = new signed short[Owner->Head().PackageFileCount]; - Pins = new Pin[Owner->Head().PackageCount]; + auto PackageCount = Owner->Head().PackageCount; + Pins = new Pin[PackageCount]; VerPins = new Pin[Owner->Head().VersionCount]; - for (unsigned long I = 0; I != Owner->Head().PackageCount; I++) + for (decltype(PackageCount) I = 0; I != PackageCount; ++I) Pins[I].Type = pkgVersionMatch::None; - for (unsigned long I = 0; I != Owner->Head().VersionCount; I++) + auto VersionCount = Owner->Head().VersionCount; + for (decltype(VersionCount) I = 0; I != VersionCount; ++I) VerPins[I].Type = pkgVersionMatch::None; // The config file has a master override. -- cgit v1.2.3