summaryrefslogtreecommitdiff
path: root/src/pugixml.cpp
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2017-11-13 19:29:42 -0800
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2017-11-13 19:29:42 -0800
commit257fbb4e1b09b0f1a6b2020ae2db190b87c8f9c7 (patch)
tree09d3cd881394b45eec1efee1fdc949a64171769e /src/pugixml.cpp
parent344c74a74c350f755d916ef6e6ac4b75160dcf86 (diff)
Use raw pointers in xml_node::traverse implementation
This makes it a bit faster and matches other internal code better.
Diffstat (limited to 'src/pugixml.cpp')
-rw-r--r--src/pugixml.cpp27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/pugixml.cpp b/src/pugixml.cpp
index 071649b..379b4ab 100644
--- a/src/pugixml.cpp
+++ b/src/pugixml.cpp
@@ -6202,10 +6202,10 @@ namespace pugi
{
walker._depth = -1;
- xml_node arg_begin = *this;
+ xml_node arg_begin(_root);
if (!walker.begin(arg_begin)) return false;
- xml_node cur = first_child();
+ xml_node_struct* cur = _root ? _root->first_child + 0 : 0;
if (cur)
{
@@ -6213,36 +6213,35 @@ namespace pugi
do
{
- xml_node arg_for_each = cur;
+ xml_node arg_for_each(cur);
if (!walker.for_each(arg_for_each))
return false;
- if (cur.first_child())
+ if (cur->first_child)
{
++walker._depth;
- cur = cur.first_child();
+ cur = cur->first_child;
}
- else if (cur.next_sibling())
- cur = cur.next_sibling();
+ else if (cur->next_sibling)
+ cur = cur->next_sibling;
else
{
- // Borland C++ workaround
- while (!cur.next_sibling() && cur != *this && !cur.parent().empty())
+ while (!cur->next_sibling && cur != _root && cur->parent)
{
--walker._depth;
- cur = cur.parent();
+ cur = cur->parent;
}
- if (cur != *this)
- cur = cur.next_sibling();
+ if (cur != _root)
+ cur = cur->next_sibling;
}
}
- while (cur && cur != *this);
+ while (cur && cur != _root);
}
assert(walker._depth == -1);
- xml_node arg_end = *this;
+ xml_node arg_end(_root);
return walker.end(arg_end);
}