msxml3: Simplify IXMLDOMNodeMap::removeNamedItem
Michael Karcher
wine at mkarcher.dialup.fu-berlin.de
Sun Nov 2 06:34:44 CST 2008
Now that I start to get the libxml2 API, the unnecessary copy
I introduced starts to bother me.
---
dlls/msxml3/nodemap.c | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/dlls/msxml3/nodemap.c b/dlls/msxml3/nodemap.c
index e4150e5..f3491a4 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,14 +314,16 @@ 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 );
}
- xmlRemoveProp( attr );
-
+ else
+ {
+ if( xmlRemoveProp( attr ) == -1 )
+ ERR("xmlRemoveProp failed\n");
+ }
+
return S_OK;
}
--
1.5.6.5
More information about the wine-patches
mailing list