summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2014-10-10 19:35:09 -0700
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2014-10-10 19:35:09 -0700
commit97451b2eee183ea3e19a7abbd9716d879218ad8f (patch)
treef65b113b5e197b72c04f1a5fbe4a77f595595503 /src
parent7795f00fbadde2397b5b2631c37f62ef8a21acef (diff)
parentccf8adce05cc70e9ca6ad5475024d1c26eeff098 (diff)
Merge branch 'master' into compact
Diffstat (limited to 'src')
-rw-r--r--src/pugixml.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/pugixml.cpp b/src/pugixml.cpp
index 7a8d7c1..748ef2b 100644
--- a/src/pugixml.cpp
+++ b/src/pugixml.cpp
@@ -1245,18 +1245,6 @@ PUGI__NS_BEGIN
node->first_attribute = attr;
}
- inline void insert_attribute_before(xml_attribute_struct* attr, xml_attribute_struct* place, xml_node_struct* node)
- {
- if (place->prev_attribute_c->next_attribute)
- place->prev_attribute_c->next_attribute = attr;
- else
- node->first_attribute = attr;
-
- attr->prev_attribute_c = place->prev_attribute_c;
- attr->next_attribute = place;
- place->prev_attribute_c = attr;
- }
-
inline void insert_attribute_after(xml_attribute_struct* attr, xml_attribute_struct* place, xml_node_struct* node)
{
if (place->next_attribute)
@@ -1269,6 +1257,18 @@ PUGI__NS_BEGIN
place->next_attribute = attr;
}
+ inline void insert_attribute_before(xml_attribute_struct* attr, xml_attribute_struct* place, xml_node_struct* node)
+ {
+ if (place->prev_attribute_c->next_attribute)
+ place->prev_attribute_c->next_attribute = attr;
+ else
+ node->first_attribute = attr;
+
+ attr->prev_attribute_c = place->prev_attribute_c;
+ attr->next_attribute = place;
+ place->prev_attribute_c = attr;
+ }
+
inline void remove_attribute(xml_attribute_struct* attr, xml_node_struct* node)
{
if (attr->next_attribute)
@@ -5399,7 +5399,7 @@ namespace pugi
return a;
}
- PUGI__FN xml_attribute xml_node::insert_attribute_before(const char_t* name_, const xml_attribute& attr)
+ PUGI__FN xml_attribute xml_node::insert_attribute_after(const char_t* name_, const xml_attribute& attr)
{
if (type() != node_element && type() != node_declaration) return xml_attribute();
if (!attr || !impl::is_attribute_of(attr._attr, _root)) return xml_attribute();
@@ -5410,14 +5410,14 @@ namespace pugi
xml_attribute a(impl::allocate_attribute(alloc));
if (!a) return xml_attribute();
- impl::insert_attribute_before(a._attr, attr._attr, _root);
+ impl::insert_attribute_after(a._attr, attr._attr, _root);
a.set_name(name_);
return a;
}
- PUGI__FN xml_attribute xml_node::insert_attribute_after(const char_t* name_, const xml_attribute& attr)
+ PUGI__FN xml_attribute xml_node::insert_attribute_before(const char_t* name_, const xml_attribute& attr)
{
if (type() != node_element && type() != node_declaration) return xml_attribute();
if (!attr || !impl::is_attribute_of(attr._attr, _root)) return xml_attribute();
@@ -5428,7 +5428,7 @@ namespace pugi
xml_attribute a(impl::allocate_attribute(alloc));
if (!a) return xml_attribute();
- impl::insert_attribute_after(a._attr, attr._attr, _root);
+ impl::insert_attribute_before(a._attr, attr._attr, _root);
a.set_name(name_);