Commit 2adcef79 authored by Michael Karcher's avatar Michael Karcher Committed by Alexandre Julliard

msxml3: Simplify IXMLDOMNodeMap::removeNamedItem.

parent 813da724
...@@ -289,7 +289,7 @@ static HRESULT WINAPI xmlnodemap_removeNamedItem( ...@@ -289,7 +289,7 @@ static HRESULT WINAPI xmlnodemap_removeNamedItem(
{ {
xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( iface ); xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( iface );
xmlChar *element_name; xmlChar *element_name;
xmlAttrPtr attr, attr_copy; xmlAttrPtr attr;
xmlNodePtr node; xmlNodePtr node;
TRACE("%p %s %p\n", This, debugstr_w(name), namedItem ); TRACE("%p %s %p\n", This, debugstr_w(name), namedItem );
...@@ -314,13 +314,15 @@ static HRESULT WINAPI xmlnodemap_removeNamedItem( ...@@ -314,13 +314,15 @@ static HRESULT WINAPI xmlnodemap_removeNamedItem(
if ( namedItem ) if ( namedItem )
{ {
attr_copy = xmlCopyProp( NULL, attr ); xmlUnlinkNode( (xmlNodePtr) attr );
attr_copy->doc = node->doc; xmldoc_add_orphan( attr->doc, (xmlNodePtr) attr );
/* The cast here is OK, xmlFreeNode handles xmlAttrPtr pointers */ *namedItem = create_node( (xmlNodePtr) attr );
xmldoc_add_orphan(attr_copy->doc, (xmlNodePtr) attr_copy); }
*namedItem = create_node( (xmlNodePtr) attr_copy ); else
{
if( xmlRemoveProp( attr ) == -1 )
ERR("xmlRemoveProp failed\n");
} }
xmlRemoveProp( attr );
return S_OK; return S_OK;
} }
......
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