summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2020-06-30 10:11:09 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2020-07-02 18:57:11 +0200
commit1bfc0907c987758529bcdc4ebfb34364702a2d8b (patch)
treeb265b58b440b45d5f4d921522939a6c4fa3d9f7a /apt-pkg/contrib
parentabba628268308c7c23f168f01966a88fe208885e (diff)
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.
Diffstat (limited to 'apt-pkg/contrib')
-rw-r--r--apt-pkg/contrib/srvrec.cc17
1 files changed, 6 insertions, 11 deletions
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<SrvRec> &Result)
// sort them by priority
std::stable_sort(Result.begin(), Result.end());
- for(std::vector<SrvRec>::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;
}