quartz: Use StdMemAllocator_from_IMemAllocator() instead of casts.

This commit is contained in:
Michael Stefaniuc 2012-07-03 00:21:28 +02:00 committed by Alexandre Julliard
parent 9262c55a2e
commit 56e3b22f6c

View File

@ -809,9 +809,14 @@ typedef struct StdMemAllocator
LPVOID pMemory; LPVOID pMemory;
} StdMemAllocator; } StdMemAllocator;
static inline StdMemAllocator *StdMemAllocator_from_IMemAllocator(IMemAllocator * iface)
{
return CONTAINING_RECORD(iface, StdMemAllocator, base.IMemAllocator_iface);
}
static HRESULT StdMemAllocator_Alloc(IMemAllocator * iface) static HRESULT StdMemAllocator_Alloc(IMemAllocator * iface)
{ {
StdMemAllocator *This = (StdMemAllocator *)iface; StdMemAllocator *This = StdMemAllocator_from_IMemAllocator(iface);
StdMediaSample2 * pSample = NULL; StdMediaSample2 * pSample = NULL;
SYSTEM_INFO si; SYSTEM_INFO si;
LONG i; LONG i;
@ -849,7 +854,7 @@ static HRESULT StdMemAllocator_Alloc(IMemAllocator * iface)
static HRESULT StdMemAllocator_Free(IMemAllocator * iface) static HRESULT StdMemAllocator_Free(IMemAllocator * iface)
{ {
StdMemAllocator *This = (StdMemAllocator *)iface; StdMemAllocator *This = StdMemAllocator_from_IMemAllocator(iface);
struct list * cursor; struct list * cursor;
if (!list_empty(&This->base.used_list)) if (!list_empty(&This->base.used_list))
@ -882,7 +887,7 @@ static HRESULT StdMemAllocator_Free(IMemAllocator * iface)
static void StdMemAllocator_Destroy(IMemAllocator *iface) static void StdMemAllocator_Destroy(IMemAllocator *iface)
{ {
StdMemAllocator *This = (StdMemAllocator *)iface; StdMemAllocator *This = StdMemAllocator_from_IMemAllocator(iface);
This->csState.DebugInfo->Spare[0] = 0; This->csState.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&This->csState); DeleteCriticalSection(&This->csState);