fix: remove unnecessary check
This commit is contained in:
parent
b6bcf3ddfe
commit
2af02a59d4
@ -6062,20 +6062,19 @@ namespace pugi
|
|||||||
PUGI__FN bool xml_node::remove_attributes()
|
PUGI__FN bool xml_node::remove_attributes()
|
||||||
{
|
{
|
||||||
if (!_root) return false;
|
if (!_root) return false;
|
||||||
|
|
||||||
impl::xml_allocator& alloc = impl::get_allocator(_root);
|
impl::xml_allocator& alloc = impl::get_allocator(_root);
|
||||||
if (!alloc.reserve()) return false;
|
if (!alloc.reserve()) return false;
|
||||||
|
|
||||||
for (xml_attribute_struct* attr = _root->first_attribute; attr;)
|
for (xml_attribute_struct* attr = _root->first_attribute; attr;)
|
||||||
{
|
{
|
||||||
if (!attr) return false;
|
|
||||||
if (!impl::is_attribute_of(attr, _root)) return false;
|
|
||||||
|
|
||||||
xml_attribute_struct* next = attr->next_attribute;
|
xml_attribute_struct* next = attr->next_attribute;
|
||||||
|
|
||||||
impl::destroy_attribute(attr, alloc);
|
impl::destroy_attribute(attr, alloc);
|
||||||
|
|
||||||
attr = next;
|
attr = next;
|
||||||
}
|
}
|
||||||
|
|
||||||
_root->first_attribute = 0;
|
_root->first_attribute = 0;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user