[Pcsclite-cvs-commit] r3045 - /trunk/PCSC/src/winscard_clnt.c
rousseau at users.alioth.debian.org
rousseau at users.alioth.debian.org
Fri Jul 4 09:31:32 UTC 2008
Author: rousseau
Date: Fri Jul 4 09:31:32 2008
New Revision: 3045
URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=3045
Log:
SCardGetStatusChange(): factorize exit code using goto end;
Modified:
trunk/PCSC/src/winscard_clnt.c
Modified: trunk/PCSC/src/winscard_clnt.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/winscard_clnt.c?rev=3045&op=diff
==============================================================================
--- trunk/PCSC/src/winscard_clnt.c (original)
+++ trunk/PCSC/src/winscard_clnt.c Fri Jul 4 09:31:32 2008
@@ -1738,7 +1738,7 @@
int j;
LONG dwContextIndex;
int currentReaderCount = 0;
- LONG rv;
+ LONG rv = SCARD_S_SUCCESS;
PROFILE_START
@@ -1801,10 +1801,7 @@
rv = SCardCheckDaemonAvailability();
if (rv != SCARD_S_SUCCESS)
- {
- SYS_MutexUnLock(psContextMap[dwContextIndex].mMutex);
- return rv;
- }
+ goto end;
for (i = 0; i < PCSCLITE_MAX_READERS_CONTEXTS; i++)
{
@@ -1813,11 +1810,8 @@
/*
* Reader was found
*/
- SYS_MutexUnLock(psContextMap[dwContextIndex].mMutex);
-
- PROFILE_END(SCARD_S_SUCCESS)
-
- return SCARD_S_SUCCESS;
+ rv = SCARD_S_SUCCESS;
+ goto end;
}
}
@@ -1826,8 +1820,8 @@
/*
* return immediately - no reader available
*/
- SYS_MutexUnLock(psContextMap[dwContextIndex].mMutex);
- return SCARD_E_READER_UNAVAILABLE;
+ rv = SCARD_E_READER_UNAVAILABLE;
+ goto end;
}
SYS_USleep(PCSCLITE_STATUS_WAIT);
@@ -1838,11 +1832,8 @@
if (dwTime >= (dwTimeout * 1000))
{
- SYS_MutexUnLock(psContextMap[dwContextIndex].mMutex);
-
- PROFILE_END(SCARD_E_TIMEOUT)
-
- return SCARD_E_TIMEOUT;
+ rv = SCARD_E_TIMEOUT;
+ goto end;
}
}
}
@@ -2195,9 +2186,8 @@
*/
if (dwTime >= (dwTimeout * 1000))
{
- SYS_MutexUnLock(psContextMap[dwContextIndex].mMutex);
- PROFILE_END(SCARD_E_TIMEOUT)
- return SCARD_E_TIMEOUT;
+ rv = SCARD_E_TIMEOUT;
+ goto end;
}
}
@@ -2210,19 +2200,15 @@
Log1(PCSC_LOG_DEBUG, "Event Loop End");
- if (psContextMap[dwContextIndex].contextBlockStatus ==
- BLOCK_STATUS_RESUME)
- {
- SYS_MutexUnLock(psContextMap[dwContextIndex].mMutex);
- PROFILE_END(SCARD_E_CANCELLED)
- return SCARD_E_CANCELLED;
- }
-
+ if (psContextMap[dwContextIndex].contextBlockStatus == BLOCK_STATUS_RESUME)
+ rv = SCARD_E_CANCELLED;
+
+end:
SYS_MutexUnLock(psContextMap[dwContextIndex].mMutex);
- PROFILE_END(SCARD_S_SUCCESS)
-
- return SCARD_S_SUCCESS;
+ PROFILE_END(rv)
+
+ return rv;
}
/**
More information about the Pcsclite-cvs-commit
mailing list