Jacek Caban : crypt32: Pass context as context_t to Context_Release.
Alexandre Julliard
julliard at winehq.org
Mon Oct 14 12:39:29 CDT 2013
Module: wine
Branch: master
Commit: 17e1dfef9beb29b418e9cf94f7ecbf11de000bdd
URL: http://source.winehq.org/git/wine.git/?a=commit;h=17e1dfef9beb29b418e9cf94f7ecbf11de000bdd
Author: Jacek Caban <jacek at codeweavers.com>
Date: Mon Oct 14 14:47:17 2013 +0200
crypt32: Pass context as context_t to Context_Release.
---
dlls/crypt32/cert.c | 2 +-
dlls/crypt32/context.c | 21 ++++++++++-----------
dlls/crypt32/crl.c | 2 +-
dlls/crypt32/crypt32_private.h | 2 +-
dlls/crypt32/ctl.c | 2 +-
5 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/dlls/crypt32/cert.c b/dlls/crypt32/cert.c
index 9e47847..678a44b 100644
--- a/dlls/crypt32/cert.c
+++ b/dlls/crypt32/cert.c
@@ -202,7 +202,7 @@ BOOL WINAPI CertFreeCertificateContext(PCCERT_CONTEXT pCertContext)
TRACE("(%p)\n", pCertContext);
if (pCertContext)
- ret = Context_Release((void *)pCertContext, CertDataContext_Free);
+ ret = Context_Release(&cert_from_ptr(pCertContext)->base, CertDataContext_Free);
return ret;
}
diff --git a/dlls/crypt32/context.c b/dlls/crypt32/context.c
index a91b63b..2f71c5b 100644
--- a/dlls/crypt32/context.c
+++ b/dlls/crypt32/context.c
@@ -103,30 +103,29 @@ CONTEXT_PROPERTY_LIST *Context_GetProperties(const void *context)
return ptr->properties;
}
-BOOL Context_Release(void *context, ContextFreeFunc dataContextFree)
+BOOL Context_Release(context_t *context, ContextFreeFunc dataContextFree)
{
- BASE_CONTEXT *base = BASE_CONTEXT_FROM_CONTEXT(context);
BOOL ret = TRUE;
- if (base->ref <= 0)
+ if (context->ref <= 0)
{
- ERR("%p's ref count is %d\n", context, base->ref);
+ ERR("%p's ref count is %d\n", context, context->ref);
return FALSE;
}
- if (InterlockedDecrement(&base->ref) == 0)
+ if (InterlockedDecrement(&context->ref) == 0)
{
TRACE("freeing %p\n", context);
- if (!base->linked)
+ if (!context->linked)
{
- ContextPropertyList_Free(base->properties);
- dataContextFree(context);
+ ContextPropertyList_Free(context->properties);
+ dataContextFree(CONTEXT_FROM_BASE_CONTEXT(context));
} else {
- Context_Release(CONTEXT_FROM_BASE_CONTEXT(base->linked), dataContextFree);
+ Context_Release(context->linked, dataContextFree);
}
- CryptMemFree(base);
+ CryptMemFree(context);
}
else
- TRACE("%p's ref count is %d\n", context, base->ref);
+ TRACE("%p's ref count is %d\n", context, context->ref);
return ret;
}
diff --git a/dlls/crypt32/crl.c b/dlls/crypt32/crl.c
index 5f127cb..fcdec5b 100644
--- a/dlls/crypt32/crl.c
+++ b/dlls/crypt32/crl.c
@@ -346,7 +346,7 @@ BOOL WINAPI CertFreeCRLContext( PCCRL_CONTEXT pCrlContext)
TRACE("(%p)\n", pCrlContext);
if (pCrlContext)
- ret = Context_Release((void *)pCrlContext, CrlDataContext_Free);
+ ret = Context_Release(&crl_from_ptr(pCrlContext)->base, CrlDataContext_Free);
return ret;
}
diff --git a/dlls/crypt32/crypt32_private.h b/dlls/crypt32/crypt32_private.h
index 18a3523..4a4a614 100644
--- a/dlls/crypt32/crypt32_private.h
+++ b/dlls/crypt32/crypt32_private.h
@@ -415,7 +415,7 @@ typedef void (*ContextFreeFunc)(void *context);
* If a data context has its ref count reach 0, calls dataContextFree on it.
* Returns FALSE if the reference count is <= 0 when called.
*/
-BOOL Context_Release(void *context, ContextFreeFunc dataContextFree) DECLSPEC_HIDDEN;
+BOOL Context_Release(context_t *context, ContextFreeFunc dataContextFree) DECLSPEC_HIDDEN;
/**
* Context property list functions
diff --git a/dlls/crypt32/ctl.c b/dlls/crypt32/ctl.c
index 2ee94ab..9b5837a 100644
--- a/dlls/crypt32/ctl.c
+++ b/dlls/crypt32/ctl.c
@@ -478,7 +478,7 @@ BOOL WINAPI CertFreeCTLContext(PCCTL_CONTEXT pCTLContext)
TRACE("(%p)\n", pCTLContext);
if (pCTLContext)
- ret = Context_Release((void *)pCTLContext, CTLDataContext_Free);
+ ret = Context_Release(&ctl_from_ptr(pCTLContext)->base, CTLDataContext_Free);
return ret;
}
More information about the wine-cvs
mailing list