[libxml++] C++11: More use of auto.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxml++] C++11: More use of auto.
- Date: Mon, 20 Jul 2015 09:00:26 +0000 (UTC)
commit 9618504f2cbda56acbd102ab87a233b1b973ff84
Author: Murray Cumming <murrayc murrayc com>
Date: Mon Jul 20 11:00:08 2015 +0200
C++11: More use of auto.
libxml++/document.cc | 8 ++++----
libxml++/nodes/element.cc | 6 +++---
libxml++/nodes/node.cc | 4 ++--
3 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/libxml++/document.cc b/libxml++/document.cc
index b289c4a..e4f5c1c 100644
--- a/libxml++/document.cc
+++ b/libxml++/document.cc
@@ -41,7 +41,7 @@ void find_wrappers(xmlNode* node, NodeMap& node_map)
if (node->type != XML_ENTITY_REF_NODE)
{
// Walk the children list.
- for (xmlNode* child = node->children; child; child = child->next)
+ for (auto child = node->children; child; child = child->next)
find_wrappers(child, node_map);
}
@@ -74,7 +74,7 @@ void find_wrappers(xmlNode* node, NodeMap& node_map)
//_xmlNode::properties would be a nonsense value, leading to crashes
//(and shown as valgrind warnings), so we return above, to avoid
//checking it here.
- for (xmlAttr* attr = node->properties; attr; attr = attr->next)
+ for (auto attr = node->properties; attr; attr = attr->next)
find_wrappers(reinterpret_cast<xmlNode*>(attr), node_map);
}
@@ -88,7 +88,7 @@ void remove_found_wrappers(xmlNode* node, NodeMap& node_map)
if (node->type != XML_ENTITY_REF_NODE)
{
// Walk the children list.
- for (xmlNode* child = node->children; child; child = child->next)
+ for (auto child = node->children; child; child = child->next)
remove_found_wrappers(child, node_map);
}
@@ -126,7 +126,7 @@ void remove_found_wrappers(xmlNode* node, NodeMap& node_map)
return;
// Walk the attributes list.
- for (xmlAttr* attr = node->properties; attr; attr = attr->next)
+ for (auto attr = node->properties; attr; attr = attr->next)
remove_found_wrappers(reinterpret_cast<xmlNode*>(attr), node_map);
}
diff --git a/libxml++/nodes/element.cc b/libxml++/nodes/element.cc
index 4f60369..a2a4f55 100644
--- a/libxml++/nodes/element.cc
+++ b/libxml++/nodes/element.cc
@@ -23,7 +23,7 @@ Element::~Element()
Element::AttributeList Element::get_attributes()
{
AttributeList attributes;
- for(xmlAttr* attr = cobj()->properties; attr; attr = attr->next)
+ for(auto attr = cobj()->properties; attr; attr = attr->next)
{
Node::create_wrapper(reinterpret_cast<xmlNode*>(attr));
attributes.push_back(reinterpret_cast<Attribute*>(attr->_private));
@@ -120,7 +120,7 @@ void Element::remove_attribute(const Glib::ustring& name, const Glib::ustring& n
const TextNode* Element::get_child_text() const
{
// FIXME: return only the first content node
- for(xmlNode* child = cobj()->children; child; child = child->next)
+ for(auto child = cobj()->children; child; child = child->next)
if(child->type == XML_TEXT_NODE)
{
Node::create_wrapper(child);
@@ -134,7 +134,7 @@ TextNode* Element::get_child_text()
{
// TODO: This only returns the first content node.
// What should we do instead? Update the documentation if we change this. murrayc.
- for(xmlNode* child = cobj()->children; child; child = child->next)
+ for(auto child = cobj()->children; child; child = child->next)
if(child->type == XML_TEXT_NODE)
{
Node::create_wrapper(child);
diff --git a/libxml++/nodes/node.cc b/libxml++/nodes/node.cc
index 5208f90..cd3263e 100644
--- a/libxml++/nodes/node.cc
+++ b/libxml++/nodes/node.cc
@@ -739,7 +739,7 @@ void Node::free_wrappers(xmlNode* node)
if (node->type != XML_ENTITY_REF_NODE)
{
//Walk the children list.
- for (xmlNode* child = node->children; child; child = child->next)
+ for (auto child = node->children; child; child = child->next)
free_wrappers(child);
}
@@ -772,7 +772,7 @@ void Node::free_wrappers(xmlNode* node)
//_xmlNode::properties would be a nonsense value, leading to crashes,
//(and shown as valgrind warnings), so we return above, to avoid
//checking it here.
- for(xmlAttr* attr = node->properties; attr; attr = attr->next)
+ for(auto attr = node->properties; attr; attr = attr->next)
free_wrappers(reinterpret_cast<xmlNode*>(attr));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]