[Pcsclite-git-commit] [PCSC] 02/03: removeReader(): reformat code
Ludovic Rousseau
rousseau at moszumanska.debian.org
Thu May 4 15:31:41 UTC 2017
This is an automated email from the git hooks/post-receive script.
rousseau pushed a commit to branch master
in repository PCSC.
commit 1928b55be239fdd853c67bcc355c59d908978d71
Author: Ludovic Rousseau <ludovic.rousseau at free.fr>
Date: Thu May 4 09:51:16 2017 +0200
removeReader(): reformat code
The complete function code was inside a { } block.
I removed the { } block and one level of indentation.
---
src/readerfactory.c | 110 ++++++++++++++++++++++++++--------------------------
1 file changed, 54 insertions(+), 56 deletions(-)
diff --git a/src/readerfactory.c b/src/readerfactory.c
index d8f1ee1..5b61ca1 100644
--- a/src/readerfactory.c
+++ b/src/readerfactory.c
@@ -615,74 +615,72 @@ LONG RFRemoveReader(const char *readerName, int port)
LONG removeReader(READER_CONTEXT * sContext)
{
- {
- /* Try to destroy the thread */
- if (sContext -> pthThread)
- (void)EHDestroyEventHandler(sContext);
+ /* Try to destroy the thread */
+ if (sContext -> pthThread)
+ (void)EHDestroyEventHandler(sContext);
- if ((NULL == sContext->pMutex) || (NULL == sContext->pFeeds))
- {
- Log1(PCSC_LOG_ERROR,
+ if ((NULL == sContext->pMutex) || (NULL == sContext->pFeeds))
+ {
+ Log1(PCSC_LOG_ERROR,
"Trying to remove an already removed driver");
- return SCARD_E_INVALID_VALUE;
- }
+ return SCARD_E_INVALID_VALUE;
+ }
- RFUnInitializeReader(sContext);
+ RFUnInitializeReader(sContext);
- *sContext->pMutex -= 1;
+ *sContext->pMutex -= 1;
- /* free shared resources when the last slot is closed */
- if (0 == *sContext->pMutex)
- {
- (void)pthread_mutex_destroy(sContext->mMutex);
- free(sContext->mMutex);
- sContext->mMutex = NULL;
- free(sContext->library);
- free(sContext->device);
- free(sContext->pMutex);
- sContext->pMutex = NULL;
- }
+ /* free shared resources when the last slot is closed */
+ if (0 == *sContext->pMutex)
+ {
+ (void)pthread_mutex_destroy(sContext->mMutex);
+ free(sContext->mMutex);
+ sContext->mMutex = NULL;
+ free(sContext->library);
+ free(sContext->device);
+ free(sContext->pMutex);
+ sContext->pMutex = NULL;
+ }
- *sContext->pFeeds -= 1;
+ *sContext->pFeeds -= 1;
- /* Added by Dave to free the pFeeds variable */
- if (*sContext->pFeeds == 0)
- {
- free(sContext->pFeeds);
- sContext->pFeeds = NULL;
- }
+ /* Added by Dave to free the pFeeds variable */
+ if (*sContext->pFeeds == 0)
+ {
+ free(sContext->pFeeds);
+ sContext->pFeeds = NULL;
+ }
- (void)pthread_mutex_destroy(&sContext->powerState_lock);
- sContext->version = 0;
- sContext->port = 0;
- sContext->contexts = 0;
- sContext->slot = 0;
- sContext->hLockId = 0;
- sContext->LockCount = 0;
- sContext->vHandle = NULL;
-
- (void)pthread_mutex_lock(&sContext->handlesList_lock);
- while (list_size(&sContext->handlesList) != 0)
- {
- int lrv;
- RDR_CLIHANDLES *currentHandle;
+ (void)pthread_mutex_destroy(&sContext->powerState_lock);
+ sContext->version = 0;
+ sContext->port = 0;
+ sContext->contexts = 0;
+ sContext->slot = 0;
+ sContext->hLockId = 0;
+ sContext->LockCount = 0;
+ sContext->vHandle = NULL;
+
+ (void)pthread_mutex_lock(&sContext->handlesList_lock);
+ while (list_size(&sContext->handlesList) != 0)
+ {
+ int lrv;
+ RDR_CLIHANDLES *currentHandle;
- currentHandle = list_get_at(&sContext->handlesList, 0);
- lrv = list_delete_at(&sContext->handlesList, 0);
- if (lrv < 0)
- Log2(PCSC_LOG_CRITICAL,
+ currentHandle = list_get_at(&sContext->handlesList, 0);
+ lrv = list_delete_at(&sContext->handlesList, 0);
+ if (lrv < 0)
+ Log2(PCSC_LOG_CRITICAL,
"list_delete_at failed with return value: %d", lrv);
- free(currentHandle);
- }
- (void)pthread_mutex_unlock(&sContext->handlesList_lock);
- (void)pthread_mutex_destroy(&sContext->handlesList_lock);
- list_destroy(&sContext->handlesList);
- dwNumReadersContexts -= 1;
-
- /* signal an event to clients */
- (void)EHSignalEventToClients();
+ free(currentHandle);
}
+ (void)pthread_mutex_unlock(&sContext->handlesList_lock);
+ (void)pthread_mutex_destroy(&sContext->handlesList_lock);
+ list_destroy(&sContext->handlesList);
+ dwNumReadersContexts -= 1;
+
+ /* signal an event to clients */
+ (void)EHSignalEventToClients();
return SCARD_S_SUCCESS;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pcsclite/PCSC.git
More information about the Pcsclite-cvs-commit
mailing list