Commit 9618504f authored by Murray Cumming's avatar Murray Cumming

C++11: More use of auto.

parent 567b2678
......@@ -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);
}
......
......@@ -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);
......
......@@ -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));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment