Skip to content

Commit 77becea

Browse files
nehebkjellahl
authored andcommitted
clang-tidy: use range loops
Found with modernize-loop-convert Signed-off-by: Rosen Penev <rosenp@gmail.com>
1 parent 6170fd1 commit 77becea

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

libxml++/nodes/node.cc

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,10 @@ Tvector find_common(const xmlpp::ustring& xpath,
6565

6666
if (namespaces)
6767
{
68-
for (xmlpp::Node::PrefixNsMap::const_iterator it = namespaces->begin();
69-
it != namespaces->end(); ++it)
68+
for (const auto& [prefix, ns_uri] : *namespaces)
7069
xmlXPathRegisterNs(ctxt,
71-
reinterpret_cast<const xmlChar*>(it->first.c_str()),
72-
reinterpret_cast<const xmlChar*>(it->second.c_str()));
70+
reinterpret_cast<const xmlChar*>(prefix.c_str()),
71+
reinterpret_cast<const xmlChar*>(ns_uri.c_str()));
7372
}
7473

7574
auto result = xmlXPathEval((const xmlChar*)xpath.c_str(), ctxt);
@@ -140,11 +139,10 @@ xmlXPathObject* eval_common(const xmlpp::ustring& xpath,
140139

141140
if (namespaces)
142141
{
143-
for (xmlpp::Node::PrefixNsMap::const_iterator it = namespaces->begin();
144-
it != namespaces->end(); ++it)
142+
for (const auto& [prefix, ns_uri] : *namespaces)
145143
xmlXPathRegisterNs(ctxt,
146-
reinterpret_cast<const xmlChar*>(it->first.c_str()),
147-
reinterpret_cast<const xmlChar*>(it->second.c_str()));
144+
reinterpret_cast<const xmlChar*>(prefix.c_str()),
145+
reinterpret_cast<const xmlChar*>(ns_uri.c_str()));
148146
}
149147

150148
auto xpath_value = xmlXPathEvalExpression(

0 commit comments

Comments
 (0)