diff --git a/dlls/msxml3/domdoc.c b/dlls/msxml3/domdoc.c index 10892d40757..e8b5445df19 100644 --- a/dlls/msxml3/domdoc.c +++ b/dlls/msxml3/domdoc.c @@ -1642,9 +1642,7 @@ static HRESULT WINAPI domdoc_get_implementation( if(!impl) return E_INVALIDARG; - *impl = (IXMLDOMImplementation*)create_doc_Implementation(); - - return S_OK; + return create_dom_implementation(impl); } static HRESULT WINAPI domdoc_get_documentElement( diff --git a/dlls/msxml3/domimpl.c b/dlls/msxml3/domimpl.c index 52f2e40dc9e..b7db00f4667 100644 --- a/dlls/msxml3/domimpl.c +++ b/dlls/msxml3/domimpl.c @@ -189,17 +189,18 @@ static dispex_static_data_t dimimpl_dispex = { dimimpl_iface_tids }; -IUnknown* create_doc_Implementation(void) +HRESULT create_dom_implementation(IXMLDOMImplementation **ret) { - domimpl *This; + domimpl *object; - This = heap_alloc( sizeof *This ); - if ( !This ) - return NULL; + if (!(object = heap_alloc(sizeof(*object)))) + return E_OUTOFMEMORY; - This->IXMLDOMImplementation_iface.lpVtbl = &dimimpl_vtbl; - This->ref = 1; - init_dispex(&This->dispex, (IUnknown*)&This->IXMLDOMImplementation_iface, &dimimpl_dispex); + object->IXMLDOMImplementation_iface.lpVtbl = &dimimpl_vtbl; + object->ref = 1; + init_dispex(&object->dispex, (IUnknown *)&object->IXMLDOMImplementation_iface, &dimimpl_dispex); - return (IUnknown*)&This->IXMLDOMImplementation_iface; + *ret = &object->IXMLDOMImplementation_iface; + + return S_OK; } diff --git a/dlls/msxml3/msxml_private.h b/dlls/msxml3/msxml_private.h index d578d5de560..29b1156775c 100644 --- a/dlls/msxml3/msxml_private.h +++ b/dlls/msxml3/msxml_private.h @@ -180,12 +180,12 @@ extern IUnknown *create_comment( xmlNodePtr ) DECLSPEC_HIDDEN; extern IUnknown *create_cdata( xmlNodePtr ) DECLSPEC_HIDDEN; extern IXMLDOMNodeList *create_children_nodelist( xmlNodePtr ) DECLSPEC_HIDDEN; extern IXMLDOMNamedNodeMap *create_nodemap( xmlNodePtr, const struct nodemap_funcs* ) DECLSPEC_HIDDEN; -extern IUnknown *create_doc_Implementation(void) DECLSPEC_HIDDEN; extern IUnknown *create_doc_fragment( xmlNodePtr ) DECLSPEC_HIDDEN; extern IUnknown *create_doc_entity_ref( xmlNodePtr ) DECLSPEC_HIDDEN; extern IUnknown *create_doc_type( xmlNodePtr ) DECLSPEC_HIDDEN; extern HRESULT create_selection( xmlNodePtr, xmlChar*, IXMLDOMNodeList** ) DECLSPEC_HIDDEN; extern HRESULT create_enumvariant( IUnknown*, BOOL, const struct enumvariant_funcs*, IEnumVARIANT**) DECLSPEC_HIDDEN; +extern HRESULT create_dom_implementation(IXMLDOMImplementation **obj) DECLSPEC_HIDDEN; /* data accessors */ xmlNodePtr xmlNodePtr_from_domnode( IXMLDOMNode *iface, xmlElementType type ) DECLSPEC_HIDDEN;