Nikolay Sivov : oleaut32: Simplify connection point creation.

Alexandre Julliard julliard at wine.codeweavers.com
Thu May 7 09:01:44 CDT 2015


Module: wine
Branch: master
Commit: 72eaeb14a6021aacf88d7189bdb2a4177e8c5ba9
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=72eaeb14a6021aacf88d7189bdb2a4177e8c5ba9

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Thu May  7 10:39:11 2015 +0300

oleaut32: Simplify connection point creation.

---

 dlls/oleaut32/connpt.c | 46 ++++++++++++++++------------------------------
 1 file changed, 16 insertions(+), 30 deletions(-)

diff --git a/dlls/oleaut32/connpt.c b/dlls/oleaut32/connpt.c
index 1d7b05c..5e15e08 100644
--- a/dlls/oleaut32/connpt.c
+++ b/dlls/oleaut32/connpt.c
@@ -66,9 +66,6 @@ typedef struct ConnectionPointImpl {
   DWORD nSinks;
 } ConnectionPointImpl;
 
-static const IConnectionPointVtbl ConnectionPointImpl_VTable;
-
-
 /************************************************************************
  * Implementation of IEnumConnections
  */
@@ -105,26 +102,6 @@ static inline EnumConnectionsImpl *impl_from_IEnumConnections(IEnumConnections *
 }
 
 /************************************************************************
- * ConnectionPointImpl_Construct
- */
-static ConnectionPointImpl *ConnectionPointImpl_Construct(IUnknown *pUnk,
-							  REFIID riid)
-{
-  ConnectionPointImpl *Obj;
-
-  Obj = HeapAlloc(GetProcessHeap(), 0, sizeof(*Obj));
-  Obj->IConnectionPoint_iface.lpVtbl = &ConnectionPointImpl_VTable;
-  Obj->Obj = pUnk;
-  Obj->ref = 1;
-  Obj->iid =  *riid;
-  Obj->maxSinks = MAXSINKS;
-  Obj->sinks = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
-			 sizeof(IUnknown*) * MAXSINKS);
-  Obj->nSinks = 0;
-  return Obj;
-}
-
-/************************************************************************
  * ConnectionPointImpl_Destroy
  */
 static void ConnectionPointImpl_Destroy(ConnectionPointImpl *Obj)
@@ -615,13 +592,22 @@ HRESULT CreateConnectionPoint(IUnknown *pUnk, REFIID riid,
 			      IConnectionPoint **pCP)
 {
   ConnectionPointImpl *Obj;
-  HRESULT hr;
 
-  Obj = ConnectionPointImpl_Construct(pUnk, riid);
-  if(!Obj) return E_OUTOFMEMORY;
+  TRACE("(%p %s %p)\n", pUnk, debugstr_guid(riid), pCP);
 
-  hr = IConnectionPoint_QueryInterface(&Obj->IConnectionPoint_iface,
-                                       &IID_IConnectionPoint, (void**)pCP);
-  IConnectionPoint_Release(&Obj->IConnectionPoint_iface);
-  return hr;
+  *pCP = NULL;
+  Obj = HeapAlloc(GetProcessHeap(), 0, sizeof(*Obj));
+  if (!Obj)
+    return E_OUTOFMEMORY;
+
+  Obj->IConnectionPoint_iface.lpVtbl = &ConnectionPointImpl_VTable;
+  Obj->Obj = pUnk;
+  Obj->ref = 1;
+  Obj->iid = *riid;
+  Obj->maxSinks = MAXSINKS;
+  Obj->sinks = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IUnknown*) * MAXSINKS);
+  Obj->nSinks = 0;
+
+  *pCP = &Obj->IConnectionPoint_iface;
+  return S_OK;
 }




More information about the wine-cvs mailing list