From 2adcef79544fe17797a4a5b60ce784e2fabfd358 Mon Sep 17 00:00:00 2001 From: Michael Karcher Date: Sun, 2 Nov 2008 13:34:44 +0100 Subject: [PATCH] msxml3: Simplify IXMLDOMNodeMap::removeNamedItem. --- dlls/msxml3/nodemap.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/dlls/msxml3/nodemap.c b/dlls/msxml3/nodemap.c index e4150e5d3d2..8c7c1d01f59 100644 --- a/dlls/msxml3/nodemap.c +++ b/dlls/msxml3/nodemap.c @@ -289,7 +289,7 @@ static HRESULT WINAPI xmlnodemap_removeNamedItem( { xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( iface ); xmlChar *element_name; - xmlAttrPtr attr, attr_copy; + xmlAttrPtr attr; xmlNodePtr node; TRACE("%p %s %p\n", This, debugstr_w(name), namedItem ); @@ -314,13 +314,15 @@ static HRESULT WINAPI xmlnodemap_removeNamedItem( if ( namedItem ) { - attr_copy = xmlCopyProp( NULL, attr ); - attr_copy->doc = node->doc; - /* The cast here is OK, xmlFreeNode handles xmlAttrPtr pointers */ - xmldoc_add_orphan(attr_copy->doc, (xmlNodePtr) attr_copy); - *namedItem = create_node( (xmlNodePtr) attr_copy ); + xmlUnlinkNode( (xmlNodePtr) attr ); + xmldoc_add_orphan( attr->doc, (xmlNodePtr) attr ); + *namedItem = create_node( (xmlNodePtr) attr ); + } + else + { + if( xmlRemoveProp( attr ) == -1 ) + ERR("xmlRemoveProp failed\n"); } - xmlRemoveProp( attr ); return S_OK; }