Skip to content

Commit

Permalink
[clang-tidy] convert to range loops (jbeder#889)
Browse files Browse the repository at this point in the history
Found with modernize-loop-convert

Signed-off-by: Rosen Penev <[email protected]>
  • Loading branch information
neheb authored Jun 15, 2020
1 parent 41001d1 commit ae811c3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
12 changes: 6 additions & 6 deletions src/node_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@ node* node_data::get(node& key, shared_memory_holder /* pMemory */) const {
return nullptr;
}

for (node_map::const_iterator it = m_map.begin(); it != m_map.end(); ++it) {
if (it->first->is(key))
return it->second;
for (const auto& it : m_map) {
if (it.first->is(key))
return it.second;
}

return nullptr;
Expand All @@ -230,9 +230,9 @@ node& node_data::get(node& key, shared_memory_holder pMemory) {
throw BadSubscript(m_mark, key);
}

for (node_map::const_iterator it = m_map.begin(); it != m_map.end(); ++it) {
if (it->first->is(key))
return *it->second;
for (const auto& it : m_map) {
if (it.first->is(key))
return *it.second;
}

node& value = pMemory->create_node();
Expand Down
9 changes: 4 additions & 5 deletions src/nodeevents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ void NodeEvents::Setup(const detail::node& node) {
return;

if (node.type() == NodeType::Sequence) {
for (detail::const_node_iterator it = node.begin(); it != node.end(); ++it)
Setup(**it);
for (const auto& it : node)
Setup(*it);
} else if (node.type() == NodeType::Map) {
for (detail::const_node_iterator it = node.begin(); it != node.end();
++it) {
Expand Down Expand Up @@ -77,9 +77,8 @@ void NodeEvents::Emit(const detail::node& node, EventHandler& handler,
break;
case NodeType::Sequence:
handler.OnSequenceStart(Mark(), node.tag(), anchor, node.style());
for (detail::const_node_iterator it = node.begin(); it != node.end();
++it)
Emit(**it, handler, am);
for (const auto& it : node)
Emit(*it, handler, am);
handler.OnSequenceEnd();
break;
case NodeType::Map:
Expand Down

0 comments on commit ae811c3

Please sign in to comment.