Michael Stefaniuc : pstorec: Use an iface instead of a vtbl pointer in PStore_impl.
Alexandre Julliard
julliard at winehq.org
Mon Nov 29 13:38:41 CST 2010
Module: wine
Branch: master
Commit: d2a6d95d5a222a139d6d3d1c75e75a1ddd02f486
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d2a6d95d5a222a139d6d3d1c75e75a1ddd02f486
Author: Michael Stefaniuc <mstefani at redhat.de>
Date: Mon Nov 29 10:33:22 2010 +0100
pstorec: Use an iface instead of a vtbl pointer in PStore_impl.
---
dlls/pstorec/pstorec.c | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/dlls/pstorec/pstorec.c b/dlls/pstorec/pstorec.c
index 493501f..b2e729b 100644
--- a/dlls/pstorec/pstorec.c
+++ b/dlls/pstorec/pstorec.c
@@ -33,10 +33,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(pstores);
typedef struct
{
- const IPStoreVtbl *lpVtbl;
+ IPStore IPStore_iface;
LONG ref;
} PStore_impl;
+static inline PStore_impl *impl_from_IPStore(IPStore *iface)
+{
+ return CONTAINING_RECORD(iface, PStore_impl, IPStore_iface);
+}
+
BOOL WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID fImpLoad)
{
TRACE("%p %x %p\n", hinst, fdwReason, fImpLoad);
@@ -62,7 +67,7 @@ static HRESULT WINAPI PStore_fnQueryInterface(
REFIID riid,
LPVOID *ppvObj)
{
- PStore_impl *This = (PStore_impl *)iface;
+ PStore_impl *This = impl_from_IPStore(iface);
TRACE("%p %s\n",This,debugstr_guid(riid));
@@ -87,7 +92,7 @@ static HRESULT WINAPI PStore_fnQueryInterface(
*/
static ULONG WINAPI PStore_fnAddRef(IPStore* iface)
{
- PStore_impl *This = (PStore_impl *)iface;
+ PStore_impl *This = impl_from_IPStore(iface);
TRACE("%p %u\n", This, This->ref);
@@ -99,7 +104,7 @@ static ULONG WINAPI PStore_fnAddRef(IPStore* iface)
*/
static ULONG WINAPI PStore_fnRelease(IPStore* iface)
{
- PStore_impl *This = (PStore_impl *)iface;
+ PStore_impl *This = impl_from_IPStore(iface);
LONG ref;
TRACE("%p %u\n", This, This->ref);
@@ -359,7 +364,7 @@ HRESULT WINAPI PStoreCreateInstance( IPStore** ppProvider,
if( !ips )
return E_OUTOFMEMORY;
- ips->lpVtbl = &pstores_vtbl;
+ ips->IPStore_iface.lpVtbl = &pstores_vtbl;
ips->ref = 1;
*ppProvider = (IPStore*) ips;
More information about the wine-cvs
mailing list