From ec722448493237ff452dac3cf106f991fc75f97f Mon Sep 17 00:00:00 2001 From: Mike McCormack Date: Tue, 14 Sep 2004 17:44:14 +0000 Subject: [PATCH] Use Interlocked* functions in AddRef and Release. --- dlls/mlang/mlang.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/dlls/mlang/mlang.c b/dlls/mlang/mlang.c index a91b021d5b4..10ed940eff9 100644 --- a/dlls/mlang/mlang.c +++ b/dlls/mlang/mlang.c @@ -624,13 +624,13 @@ MLANGCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) static ULONG WINAPI MLANGCF_AddRef(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - return ++(This->ref); + return InterlockedIncrement(&This->ref); } static ULONG WINAPI MLANGCF_Release(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - ULONG ref = --This->ref; + ULONG ref = InterlockedDecrement(&This->ref); if (ref == 0) { @@ -733,12 +733,12 @@ typedef struct tagMLang_impl static ULONG WINAPI MLang_AddRef( MLang_impl* This) { - return ++(This->ref); + return InterlockedIncrement(&This->ref); } static ULONG WINAPI MLang_Release( MLang_impl* This ) { - ULONG ref = --This->ref; + ULONG ref = InterlockedDecrement(&This->ref); TRACE("%p ref = %ld\n", This, ref); if (ref == 0) @@ -823,14 +823,14 @@ static ULONG WINAPI fnIEnumCodePage_AddRef( IEnumCodePage* iface) { ICOM_THIS_MULTI(EnumCodePage_impl, vtbl_IEnumCodePage, iface); - return ++(This->ref); + return InterlockedIncrement(&This->ref); } static ULONG WINAPI fnIEnumCodePage_Release( IEnumCodePage* iface) { ICOM_THIS_MULTI(EnumCodePage_impl, vtbl_IEnumCodePage, iface); - ULONG ref = --This->ref; + ULONG ref = InterlockedDecrement(&This->ref); TRACE("%p ref = %ld\n", This, ref); if (ref == 0) @@ -1009,14 +1009,14 @@ static ULONG WINAPI fnIEnumScript_AddRef( IEnumScript* iface) { ICOM_THIS_MULTI(EnumScript_impl, vtbl_IEnumScript, iface); - return ++(This->ref); + return InterlockedIncrement(&This->ref); } static ULONG WINAPI fnIEnumScript_Release( IEnumScript* iface) { ICOM_THIS_MULTI(EnumScript_impl, vtbl_IEnumScript, iface); - ULONG ref = --This->ref; + ULONG ref = InterlockedDecrement(&This->ref); TRACE("%p ref = %ld\n", This, ref); if (ref == 0) -- 2.11.4.GIT