From 4ebb6b7faec068e1e0fe3f7aa0e2ab3640cdfffd Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Wed, 28 Mar 2012 18:59:26 +0200 Subject: [PATCH] nfq: switch locking code to macro's to lock profiling can track the exact lock locations. --- src/source-nfq.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/source-nfq.c b/src/source-nfq.c index 05493f9089..aa7c7881dc 100644 --- a/src/source-nfq.c +++ b/src/source-nfq.c @@ -269,17 +269,15 @@ static inline void NFQMutexInit(NFQQueueVars *nq) SCMutexInit(&nq->mutex_qh, NULL); } -static inline void NFQMutexLock(NFQQueueVars *nq) -{ - if (nq->use_mutex) - SCMutexLock(&nq->mutex_qh); -} - -static inline void NFQMutexUnlock(NFQQueueVars *nq) -{ - if (nq->use_mutex) - SCMutexUnlock(&nq->mutex_qh); -} +#define NFQMutexLock(nq) do { \ + if ((nq)->use_mutex) \ + SCMutexLock(&(nq)->mutex_qh); \ +} while (0) + +#define NFQMutexUnlock(nq) do { \ + if ((nq)->use_mutex) \ + SCMutexUnlock(&(nq)->mutex_qh); \ +} while (0) int NFQSetupPkt (Packet *p, struct nfq_q_handle *qh, void *data)