From 1bfc0907c987758529bcdc4ebfb34364702a2d8b Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 30 Jun 2020 10:11:09 +0200 Subject: Reorder config check before result looping for SRV parsing debug It isn't needed to iterate over all results if we will be doing nothing anyhow as it isn't that common to have that debug option enabled. --- apt-pkg/contrib/srvrec.cc | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/contrib/srvrec.cc b/apt-pkg/contrib/srvrec.cc index 7d9bf116e..4ca208273 100644 --- a/apt-pkg/contrib/srvrec.cc +++ b/apt-pkg/contrib/srvrec.cc @@ -137,17 +137,12 @@ bool GetSrvRecords(std::string name, std::vector &Result) // sort them by priority std::stable_sort(Result.begin(), Result.end()); - for(std::vector::iterator I = Result.begin(); - I != Result.end(); ++I) - { - if (_config->FindB("Debug::Acquire::SrvRecs", false) == true) - { - std::cerr << "SrvRecs: got " << I->target - << " prio: " << I->priority - << " weight: " << I->weight - << std::endl; - } - } + if (_config->FindB("Debug::Acquire::SrvRecs", false)) + for(auto const &R : Result) + std::cerr << "SrvRecs: got " << R.target + << " prio: " << R.priority + << " weight: " << R.weight + << '\n'; return true; } -- cgit v1.2.3