[Pcsclite-cvs-commit] r4742 - in /trunk/PCSC/src: readerfactory.c readerfactory.h

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Tue Feb 9 14:53:54 UTC 2010


Author: rousseau
Date: Tue Feb  9 14:53:53 2010
New Revision: 4742

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=4742
Log:
In struct ReaderContext rename pdwMutex to pMutex and change type from
PDWORD to int *

Modified:
    trunk/PCSC/src/readerfactory.c
    trunk/PCSC/src/readerfactory.h

Modified: trunk/PCSC/src/readerfactory.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/readerfactory.c?rev=4742&op=diff
==============================================================================
--- trunk/PCSC/src/readerfactory.c (original)
+++ trunk/PCSC/src/readerfactory.c Tue Feb  9 14:53:53 2010
@@ -179,7 +179,7 @@
 	(sReadersContexts[dwContext])->LockCount = 0;
 	(sReadersContexts[dwContext])->vHandle = NULL;
 	(sReadersContexts[dwContext])->pFeeds = NULL;
-	(sReadersContexts[dwContext])->pdwMutex = NULL;
+	(sReadersContexts[dwContext])->pMutex = NULL;
 	(sReadersContexts[dwContext])->dwIdentity =
 		(dwContext + 1) << IDENTITY_SHIFT;
 	(sReadersContexts[dwContext])->readerState = NULL;
@@ -210,8 +210,8 @@
 		  (sReadersContexts[parentNode])->vHandle;
 		(sReadersContexts[dwContext])->mMutex =
 		  (sReadersContexts[parentNode])->mMutex;
-		(sReadersContexts[dwContext])->pdwMutex =
-		  (sReadersContexts[parentNode])->pdwMutex;
+		(sReadersContexts[dwContext])->pMutex =
+		  (sReadersContexts[parentNode])->pMutex;
 
 		/* Call on the parent driver to see if it is thread safe */
 		dwGetSize = sizeof(ucThread);
@@ -222,10 +222,10 @@
 		{
 			Log1(PCSC_LOG_INFO, "Driver is thread safe");
 			(sReadersContexts[dwContext])->mMutex = NULL;
-			(sReadersContexts[dwContext])->pdwMutex = NULL;
+			(sReadersContexts[dwContext])->pMutex = NULL;
 		}
 		else
-			*(sReadersContexts[dwContext])->pdwMutex += 1;
+			*(sReadersContexts[dwContext])->pMutex += 1;
 	}
 
 	if ((sReadersContexts[dwContext])->pFeeds == NULL)
@@ -246,10 +246,10 @@
 		(void)SYS_MutexInit((sReadersContexts[dwContext])->mMutex);
 	}
 
-	if ((sReadersContexts[dwContext])->pdwMutex == NULL)
-	{
-		(sReadersContexts[dwContext])->pdwMutex = malloc(sizeof(DWORD));
-		*(sReadersContexts[dwContext])->pdwMutex = 1;
+	if ((sReadersContexts[dwContext])->pMutex == NULL)
+	{
+		(sReadersContexts[dwContext])->pMutex = malloc(sizeof(int));
+		*(sReadersContexts[dwContext])->pMutex = 1;
 	}
 
 	dwNumReadersContexts += 1;
@@ -349,8 +349,8 @@
 		  (sReadersContexts[dwContext])->vHandle;
 		(sReadersContexts[dwContextB])->mMutex =
 		  (sReadersContexts[dwContext])->mMutex;
-		(sReadersContexts[dwContextB])->pdwMutex =
-		  (sReadersContexts[dwContext])->pdwMutex;
+		(sReadersContexts[dwContextB])->pMutex =
+		  (sReadersContexts[dwContext])->pMutex;
 		sReadersContexts[dwContextB]->slot =
 			sReadersContexts[dwContext]->slot + j;
 
@@ -398,11 +398,11 @@
 				malloc(sizeof(PCSCLITE_MUTEX));
 			(void)SYS_MutexInit((sReadersContexts[dwContextB])->mMutex);
 
-			(sReadersContexts[dwContextB])->pdwMutex = malloc(sizeof(DWORD));
-			*(sReadersContexts[dwContextB])->pdwMutex = 1;
+			(sReadersContexts[dwContextB])->pMutex = malloc(sizeof(int));
+			*(sReadersContexts[dwContextB])->pMutex = 1;
 		}
 		else
-			*(sReadersContexts[dwContextB])->pdwMutex += 1;
+			*(sReadersContexts[dwContextB])->pMutex += 1;
 
 		dwNumReadersContexts += 1;
 
@@ -459,7 +459,7 @@
 			return rv;
 
 		/* Destroy and free the mutex */
-		if ((NULL == sContext->pdwMutex) || (NULL == sContext->pFeeds))
+		if ((NULL == sContext->pMutex) || (NULL == sContext->pFeeds))
 		{
 			Log1(PCSC_LOG_ERROR,
 				"Trying to remove an already removed driver");
@@ -467,19 +467,19 @@
 		}
 
 		/* free shared resources when the last slot is closed */
-		if (*sContext->pdwMutex == 1)
+		if (*sContext->pMutex == 1)
 		{
 			(void)SYS_MutexDestroy(sContext->mMutex);
 			free(sContext->mMutex);
 			free(sContext->lpcLibrary);
 		}
 
-		*sContext->pdwMutex -= 1;
-
-		if (*sContext->pdwMutex == 0)
-		{
-			free(sContext->pdwMutex);
-			sContext->pdwMutex = NULL;
+		*sContext->pMutex -= 1;
+
+		if (*sContext->pMutex == 0)
+		{
+			free(sContext->pMutex);
+			sContext->pMutex = NULL;
 		}
 
 		*sContext->pFeeds -= 1;

Modified: trunk/PCSC/src/readerfactory.h
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/readerfactory.h?rev=4742&op=diff
==============================================================================
--- trunk/PCSC/src/readerfactory.h (original)
+++ trunk/PCSC/src/readerfactory.h Tue Feb  9 14:53:53 2010
@@ -129,7 +129,7 @@
 		int LockCount;			/**< number of recursive locks */
 		int32_t contexts;		/**< Number of open contexts */
 		int * pFeeds;			/**< Number of shared client to lib */
-		PDWORD pdwMutex;		/**< Number of client to mutex */
+		int * pMutex;			/**< Number of client to mutex */
 
 		struct pubReaderStatesList *readerState; /**< link to the reader state */
 		/* we can't use READER_CONTEXT * here since eventhandler.h can't be




More information about the Pcsclite-cvs-commit mailing list