Skip to content

Commit 9618504

Browse files
committed
C++11: More use of auto.
1 parent 567b267 commit 9618504

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

libxml++/document.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ void find_wrappers(xmlNode* node, NodeMap& node_map)
4141
if (node->type != XML_ENTITY_REF_NODE)
4242
{
4343
// Walk the children list.
44-
for (xmlNode* child = node->children; child; child = child->next)
44+
for (auto child = node->children; child; child = child->next)
4545
find_wrappers(child, node_map);
4646
}
4747

@@ -74,7 +74,7 @@ void find_wrappers(xmlNode* node, NodeMap& node_map)
7474
//_xmlNode::properties would be a nonsense value, leading to crashes
7575
//(and shown as valgrind warnings), so we return above, to avoid
7676
//checking it here.
77-
for (xmlAttr* attr = node->properties; attr; attr = attr->next)
77+
for (auto attr = node->properties; attr; attr = attr->next)
7878
find_wrappers(reinterpret_cast<xmlNode*>(attr), node_map);
7979
}
8080

@@ -88,7 +88,7 @@ void remove_found_wrappers(xmlNode* node, NodeMap& node_map)
8888
if (node->type != XML_ENTITY_REF_NODE)
8989
{
9090
// Walk the children list.
91-
for (xmlNode* child = node->children; child; child = child->next)
91+
for (auto child = node->children; child; child = child->next)
9292
remove_found_wrappers(child, node_map);
9393
}
9494

@@ -126,7 +126,7 @@ void remove_found_wrappers(xmlNode* node, NodeMap& node_map)
126126
return;
127127

128128
// Walk the attributes list.
129-
for (xmlAttr* attr = node->properties; attr; attr = attr->next)
129+
for (auto attr = node->properties; attr; attr = attr->next)
130130
remove_found_wrappers(reinterpret_cast<xmlNode*>(attr), node_map);
131131

132132
}

libxml++/nodes/element.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Element::~Element()
2323
Element::AttributeList Element::get_attributes()
2424
{
2525
AttributeList attributes;
26-
for(xmlAttr* attr = cobj()->properties; attr; attr = attr->next)
26+
for(auto attr = cobj()->properties; attr; attr = attr->next)
2727
{
2828
Node::create_wrapper(reinterpret_cast<xmlNode*>(attr));
2929
attributes.push_back(reinterpret_cast<Attribute*>(attr->_private));
@@ -120,7 +120,7 @@ void Element::remove_attribute(const Glib::ustring& name, const Glib::ustring& n
120120
const TextNode* Element::get_child_text() const
121121
{
122122
// FIXME: return only the first content node
123-
for(xmlNode* child = cobj()->children; child; child = child->next)
123+
for(auto child = cobj()->children; child; child = child->next)
124124
if(child->type == XML_TEXT_NODE)
125125
{
126126
Node::create_wrapper(child);
@@ -134,7 +134,7 @@ TextNode* Element::get_child_text()
134134
{
135135
// TODO: This only returns the first content node.
136136
// What should we do instead? Update the documentation if we change this. murrayc.
137-
for(xmlNode* child = cobj()->children; child; child = child->next)
137+
for(auto child = cobj()->children; child; child = child->next)
138138
if(child->type == XML_TEXT_NODE)
139139
{
140140
Node::create_wrapper(child);

libxml++/nodes/node.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ void Node::free_wrappers(xmlNode* node)
739739
if (node->type != XML_ENTITY_REF_NODE)
740740
{
741741
//Walk the children list.
742-
for (xmlNode* child = node->children; child; child = child->next)
742+
for (auto child = node->children; child; child = child->next)
743743
free_wrappers(child);
744744
}
745745

@@ -772,7 +772,7 @@ void Node::free_wrappers(xmlNode* node)
772772
//_xmlNode::properties would be a nonsense value, leading to crashes,
773773
//(and shown as valgrind warnings), so we return above, to avoid
774774
//checking it here.
775-
for(xmlAttr* attr = node->properties; attr; attr = attr->next)
775+
for(auto attr = node->properties; attr; attr = attr->next)
776776
free_wrappers(reinterpret_cast<xmlNode*>(attr));
777777
}
778778

0 commit comments

Comments
 (0)