Skip to content

Commit 6be0512

Browse files
committed
Peer review cleanups.
1 parent e33d59c commit 6be0512

3 files changed

Lines changed: 43 additions & 33 deletions

File tree

src/sniffer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ void ssl_InitSniffer_ex2(int threadNum)
718718

719719
#ifdef WOLFSSL_ASYNC_CRYPT
720720
#ifndef WC_NO_ASYNC_THREADING
721-
if (wolfAsync_DevOpenThread(&devId,&threadNum) < 0)
721+
if (wolfAsync_DevOpenThread(&devId, &threadNum) < 0)
722722
#else
723723
if (wolfAsync_DevOpen(&devId) < 0)
724724
#endif

sslSniffer/sslSnifferTest/snifftest.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -600,26 +600,30 @@ typedef struct {
600600
} wm_Sem;
601601

602602
/* Posix style semaphore */
603-
static int wm_SemInit(wm_Sem *s){
603+
static int wm_SemInit(wm_Sem *s)
604+
{
604605
s->lockCount = 0;
605606
pthread_mutex_init(&s->mutex, NULL);
606607
pthread_cond_init(&s->cond, NULL);
607608
return 0;
608609
}
609-
static int wm_SemFree(wm_Sem *s){
610+
static int wm_SemFree(wm_Sem *s)
611+
{
610612
pthread_mutex_destroy(&s->mutex);
611613
pthread_cond_destroy(&s->cond);
612614
return 0;
613615
}
614-
static int wm_SemLock(wm_Sem *s){
616+
static int wm_SemLock(wm_Sem *s)
617+
{
615618
pthread_mutex_lock(&s->mutex);
616619
while (s->lockCount > 0)
617620
pthread_cond_wait(&s->cond, &s->mutex);
618621
s->lockCount++;
619622
pthread_mutex_unlock(&s->mutex);
620623
return 0;
621624
}
622-
static int wm_SemUnlock(wm_Sem *s){
625+
static int wm_SemUnlock(wm_Sem *s)
626+
{
623627
pthread_mutex_lock(&s->mutex);
624628
s->lockCount--;
625629
pthread_cond_signal(&s->cond);

wolfssl/wolfcrypt/wc_port.h

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -291,37 +291,43 @@ typedef struct wolfSSL_Ref {
291291
} wolfSSL_Ref;
292292

293293
#ifdef SINGLE_THREADED
294-
#define wolfSSL_RefInit(ref, err) do { \
295-
(ref)->count = 1; \
296-
*(err) = 0; \
297-
} while(0);
294+
#define wolfSSL_RefInit(ref, err) \
295+
do { \
296+
(ref)->count = 1; \
297+
*(err) = 0; \
298+
} while(0)
298299
#define wolfSSL_RefFree(ref)
299-
#define wolfSSL_RefInc(ref, err) do { \
300-
(ref)->count++; \
301-
*(err) = 0; \
302-
} while(0);
303-
#define wolfSSL_RefDec(ref, isZero, err) do { \
304-
(ref)->count--; \
305-
*(isZero) = ((ref)->count == 0); \
306-
*(err) = 0; \
307-
} while(0);
300+
#define wolfSSL_RefInc(ref, err) \
301+
do { \
302+
(ref)->count++; \
303+
*(err) = 0; \
304+
} while(0)
305+
#define wolfSSL_RefDec(ref, isZero, err) \
306+
do { \
307+
(ref)->count--; \
308+
*(isZero) = ((ref)->count == 0); \
309+
*(err) = 0; \
310+
} while(0)
308311
#elif defined(HAVE_C___ATOMIC)
309-
#define wolfSSL_RefInit(ref, err) do { \
310-
(ref)->count = 1; \
311-
*(err) = 0; \
312-
} while(0);
312+
#define wolfSSL_RefInit(ref, err) \
313+
do { \
314+
(ref)->count = 1; \
315+
*(err) = 0; \
316+
} while(0)
313317
#define wolfSSL_RefFree(ref)
314-
#define wolfSSL_RefInc(ref, err) do { \
315-
__atomic_fetch_add(&(ref)->count, 1, \
316-
__ATOMIC_RELAXED); \
317-
*(err) = 0; \
318-
} while(0);
319-
#define wolfSSL_RefDec(ref, isZero, err) do { \
320-
__atomic_fetch_sub(&(ref)->count, 1, \
321-
__ATOMIC_RELAXED); \
322-
*(isZero) = ((ref)->count == 0); \
323-
*(err) = 0; \
324-
} while(0);
318+
#define wolfSSL_RefInc(ref, err) \
319+
do { \
320+
__atomic_fetch_add(&(ref)->count, 1, \
321+
__ATOMIC_RELAXED); \
322+
*(err) = 0; \
323+
} while(0)
324+
#define wolfSSL_RefDec(ref, isZero, err) \
325+
do { \
326+
__atomic_fetch_sub(&(ref)->count, 1, \
327+
__ATOMIC_RELAXED); \
328+
*(isZero) = ((ref)->count == 0); \
329+
*(err) = 0; \
330+
} while(0)
325331
#else
326332
WOLFSSL_LOCAL void wolfSSL_RefInit(wolfSSL_Ref* ref, int* err);
327333
WOLFSSL_LOCAL void wolfSSL_RefFree(wolfSSL_Ref* ref);

0 commit comments

Comments
 (0)