From: JINMEI Tatuya Date: Thu, 22 Mar 2012 06:33:23 +0000 (-0700) Subject: [1688] use BOOST_FOREACH instead of dedicated for loops. X-Git-Tag: trac2351_base~226^2~116^2~66^2~10^2~7 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a6d9e2bc94cb26c34521f3f793da354fa2cb1f9b;p=thirdparty%2Fkea.git [1688] use BOOST_FOREACH instead of dedicated for loops. this could be slightly more efficient because it avoids redundant calls to vector::end(). In my experiments I actually didn't see much difference, but it doesn't harm anyway. --- diff --git a/src/bin/auth/query.cc b/src/bin/auth/query.cc index d8967d3175..b8238328aa 100644 --- a/src/bin/auth/query.cc +++ b/src/bin/auth/query.cc @@ -85,21 +85,18 @@ Query::ResponseCreator::create(Message& response, assert(added_.empty()); // Add the RRsets to the message. The order of sections is important, - // as the RRsetInserter remembers RRsets added and will not add + // as the ResponseCreator remembers RRsets added and will not add // duplicates. Adding in the order answer, authory, additional will // guarantee that if there are duplicates, the single RRset added will // appear in the most important section. - std::vector::const_iterator i; - for (i = answers.begin(); i != answers.end(); ++i) { - addRRset(response, Message::SECTION_ANSWER, *i, dnssec); + BOOST_FOREACH(const ConstRRsetPtr& rrset, answers) { + addRRset(response, Message::SECTION_ANSWER, rrset, dnssec); } - - for (i = authorities.begin(); i != authorities.end(); ++i) { - addRRset(response, Message::SECTION_AUTHORITY, *i, dnssec); + BOOST_FOREACH(const ConstRRsetPtr& rrset, authorities) { + addRRset(response, Message::SECTION_AUTHORITY, rrset, dnssec); } - - for (i = additionals.begin(); i != additionals.end(); ++i) { - addRRset(response, Message::SECTION_ADDITIONAL, *i, dnssec); + BOOST_FOREACH(const ConstRRsetPtr& rrset, additionals) { + addRRset(response, Message::SECTION_ADDITIONAL, rrset, dnssec); } }