Module: wine Branch: master Commit: 9093312bdf48c8432adc83f4e32609c76ba5c135 URL: http://source.winehq.org/git/wine.git/?a=commit;h=9093312bdf48c8432adc83f4e3...
Author: Michael Stefaniuc mstefani@redhat.de Date: Tue Nov 30 00:04:06 2010 +0100
shlwapi: Use an iface instead of an vtbl pointer in threadref.
---
dlls/shlwapi/thread.c | 17 +++++++++++------ 1 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/dlls/shlwapi/thread.c b/dlls/shlwapi/thread.c index 00d26f7..c18d5a4 100644 --- a/dlls/shlwapi/thread.c +++ b/dlls/shlwapi/thread.c @@ -122,13 +122,18 @@ typedef struct tagSHLWAPI_THREAD_INFO
typedef struct { - const IUnknownVtbl* lpVtbl; + IUnknown IUnknown_iface; LONG *ref; } threadref;
+static inline threadref *impl_from_IUnknown(IUnknown *iface) +{ + return CONTAINING_RECORD(iface, threadref, IUnknown_iface); +} + static HRESULT WINAPI threadref_QueryInterface(IUnknown *iface, REFIID riid, LPVOID *ppvObj) { - threadref * This = (threadref *)iface; + threadref * This = impl_from_IUnknown(iface);
TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), ppvObj);
@@ -149,7 +154,7 @@ static HRESULT WINAPI threadref_QueryInterface(IUnknown *iface, REFIID riid, LPV
static ULONG WINAPI threadref_AddRef(IUnknown *iface) { - threadref * This = (threadref *)iface; + threadref * This = impl_from_IUnknown(iface);
TRACE("(%p)\n", This); return InterlockedIncrement(This->ref); @@ -158,7 +163,7 @@ static ULONG WINAPI threadref_AddRef(IUnknown *iface) static ULONG WINAPI threadref_Release(IUnknown *iface) { LONG refcount; - threadref * This = (threadref *)iface; + threadref * This = impl_from_IUnknown(iface);
TRACE("(%p)\n", This);
@@ -199,11 +204,11 @@ HRESULT WINAPI SHCreateThreadRef(LONG *lprefcount, IUnknown **lppUnknown) return E_INVALIDARG;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(threadref)); - This->lpVtbl = &threadref_vt; + This->IUnknown_iface.lpVtbl = &threadref_vt; This->ref = lprefcount;
*lprefcount = 1; - *lppUnknown = (IUnknown *) This; + *lppUnknown = &This->IUnknown_iface; TRACE("=> returning S_OK with %p\n", This); return S_OK; }