From c62c8c6d42aa661cef14718c3b651a4f68b8510d Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Fri, 1 Jul 2022 21:32:39 -0700 Subject: [PATCH] clang-tidy: use range loops Found with modernize-loop-convert Signed-off-by: Rosen Penev --- libxml++/nodes/node.cc | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/libxml++/nodes/node.cc b/libxml++/nodes/node.cc index 15680ea8..d17d0aa3 100644 --- a/libxml++/nodes/node.cc +++ b/libxml++/nodes/node.cc @@ -65,11 +65,10 @@ Tvector find_common(const xmlpp::ustring& xpath, if (namespaces) { - for (xmlpp::Node::PrefixNsMap::const_iterator it = namespaces->begin(); - it != namespaces->end(); ++it) + for (const auto& [prefix, ns_uri] : *namespaces) xmlXPathRegisterNs(ctxt, - reinterpret_cast(it->first.c_str()), - reinterpret_cast(it->second.c_str())); + reinterpret_cast(prefix.c_str()), + reinterpret_cast(ns_uri.c_str())); } auto result = xmlXPathEval((const xmlChar*)xpath.c_str(), ctxt); @@ -140,11 +139,10 @@ xmlXPathObject* eval_common(const xmlpp::ustring& xpath, if (namespaces) { - for (xmlpp::Node::PrefixNsMap::const_iterator it = namespaces->begin(); - it != namespaces->end(); ++it) + for (const auto& [prefix, ns_uri] : *namespaces) xmlXPathRegisterNs(ctxt, - reinterpret_cast(it->first.c_str()), - reinterpret_cast(it->second.c_str())); + reinterpret_cast(prefix.c_str()), + reinterpret_cast(ns_uri.c_str())); } auto xpath_value = xmlXPathEvalExpression(