Module: wine Branch: master Commit: 56e3b22f6cef4a3874a80c2ddfaae0bfb4c14fa2 URL: http://source.winehq.org/git/wine.git/?a=commit;h=56e3b22f6cef4a3874a80c2ddf...
Author: Michael Stefaniuc mstefani@redhat.de Date: Tue Jul 3 00:21:28 2012 +0200
quartz: Use StdMemAllocator_from_IMemAllocator() instead of casts.
---
dlls/quartz/memallocator.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/dlls/quartz/memallocator.c b/dlls/quartz/memallocator.c index cc700c2..f1903f9 100644 --- a/dlls/quartz/memallocator.c +++ b/dlls/quartz/memallocator.c @@ -809,9 +809,14 @@ typedef struct StdMemAllocator LPVOID pMemory; } StdMemAllocator;
+static inline StdMemAllocator *StdMemAllocator_from_IMemAllocator(IMemAllocator * iface) +{ + return CONTAINING_RECORD(iface, StdMemAllocator, base.IMemAllocator_iface); +} + static HRESULT StdMemAllocator_Alloc(IMemAllocator * iface) { - StdMemAllocator *This = (StdMemAllocator *)iface; + StdMemAllocator *This = StdMemAllocator_from_IMemAllocator(iface); StdMediaSample2 * pSample = NULL; SYSTEM_INFO si; LONG i; @@ -849,7 +854,7 @@ static HRESULT StdMemAllocator_Alloc(IMemAllocator * iface)
static HRESULT StdMemAllocator_Free(IMemAllocator * iface) { - StdMemAllocator *This = (StdMemAllocator *)iface; + StdMemAllocator *This = StdMemAllocator_from_IMemAllocator(iface); struct list * cursor;
if (!list_empty(&This->base.used_list)) @@ -882,7 +887,7 @@ static HRESULT StdMemAllocator_Free(IMemAllocator * iface)
static void StdMemAllocator_Destroy(IMemAllocator *iface) { - StdMemAllocator *This = (StdMemAllocator *)iface; + StdMemAllocator *This = StdMemAllocator_from_IMemAllocator(iface);
This->csState.DebugInfo->Spare[0] = 0; DeleteCriticalSection(&This->csState);