Michael Stefaniuc : browseui: Use an iface instead of a vtbl pointer in CompCatCacheDaemon.

Alexandre Julliard julliard at winehq.org
Thu Dec 9 12:26:26 CST 2010


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

Author: Michael Stefaniuc <mstefani at redhat.de>
Date:   Wed Dec  8 22:59:29 2010 +0100

browseui: Use an iface instead of a vtbl pointer in CompCatCacheDaemon.

---

 dlls/browseui/compcatcachedaemon.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/dlls/browseui/compcatcachedaemon.c b/dlls/browseui/compcatcachedaemon.c
index 2cf15e4..f480d35 100644
--- a/dlls/browseui/compcatcachedaemon.c
+++ b/dlls/browseui/compcatcachedaemon.c
@@ -44,11 +44,16 @@
 WINE_DEFAULT_DEBUG_CHANNEL(browseui);
 
 typedef struct tagCCCD {
-    const IRunnableTaskVtbl *vtbl;
+    IRunnableTask IRunnableTask_iface;
     LONG refCount;
     CRITICAL_SECTION cs;
 } CompCatCacheDaemon;
 
+static inline CompCatCacheDaemon *impl_from_IRunnableTask(IRunnableTask *iface)
+{
+    return CONTAINING_RECORD(iface, CompCatCacheDaemon, IRunnableTask_iface);
+}
+
 static void CompCatCacheDaemon_Destructor(CompCatCacheDaemon *This)
 {
     TRACE("destroying %p\n", This);
@@ -59,7 +64,7 @@ static void CompCatCacheDaemon_Destructor(CompCatCacheDaemon *This)
 
 static HRESULT WINAPI CompCatCacheDaemon_QueryInterface(IRunnableTask *iface, REFIID iid, LPVOID *ppvOut)
 {
-    CompCatCacheDaemon *This = (CompCatCacheDaemon *)iface;
+    CompCatCacheDaemon *This = impl_from_IRunnableTask(iface);
     *ppvOut = NULL;
 
     if (IsEqualIID(iid, &IID_IRunnableTask) || IsEqualIID(iid, &IID_IUnknown))
@@ -79,13 +84,13 @@ static HRESULT WINAPI CompCatCacheDaemon_QueryInterface(IRunnableTask *iface, RE
 
 static ULONG WINAPI CompCatCacheDaemon_AddRef(IRunnableTask *iface)
 {
-    CompCatCacheDaemon *This = (CompCatCacheDaemon *)iface;
+    CompCatCacheDaemon *This = impl_from_IRunnableTask(iface);
     return InterlockedIncrement(&This->refCount);
 }
 
 static ULONG WINAPI CompCatCacheDaemon_Release(IRunnableTask *iface)
 {
-    CompCatCacheDaemon *This = (CompCatCacheDaemon *)iface;
+    CompCatCacheDaemon *This = impl_from_IRunnableTask(iface);
     ULONG ret;
 
     ret = InterlockedDecrement(&This->refCount);
@@ -146,7 +151,7 @@ HRESULT CompCatCacheDaemon_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
     if (This == NULL)
         return E_OUTOFMEMORY;
 
-    This->vtbl = &CompCatCacheDaemonVtbl;
+    This->IRunnableTask_iface.lpVtbl = &CompCatCacheDaemonVtbl;
     This->refCount = 1;
     InitializeCriticalSection(&This->cs);
 




More information about the wine-cvs mailing list