diff --git a/src/flow-manager.c b/src/flow-manager.c index 6aecc9c8b3..150f30144e 100644 --- a/src/flow-manager.c +++ b/src/flow-manager.c @@ -1138,7 +1138,7 @@ void TmModuleFlowManagerRegister (void) SCLogDebug("%s registered", tmm_modules[TMM_FLOWMANAGER].name); SC_ATOMIC_INIT(flowmgr_cnt); - SC_ATOMIC_INIT(flow_timeouts); + SC_ATOMIC_INITPTR(flow_timeouts); } void TmModuleFlowRecyclerRegister (void) diff --git a/src/flow-worker.c b/src/flow-worker.c index c65483d715..579d3858f1 100644 --- a/src/flow-worker.c +++ b/src/flow-worker.c @@ -102,7 +102,7 @@ static TmEcode FlowWorkerThreadInit(ThreadVars *tv, const void *initdata, void * if (fw == NULL) return TM_ECODE_FAILED; - SC_ATOMIC_INIT(fw->detect_thread); + SC_ATOMIC_INITPTR(fw->detect_thread); SC_ATOMIC_SET(fw->detect_thread, NULL); fw->local_bypass_pkts = StatsRegisterCounter("flow_bypassed.local_pkts", tv); diff --git a/src/tm-threads.c b/src/tm-threads.c index b8e14e1296..b049b7ed65 100644 --- a/src/tm-threads.c +++ b/src/tm-threads.c @@ -626,7 +626,7 @@ void TmSlotSetFuncAppend(ThreadVars *tv, TmModule *tm, const void *data) if (unlikely(slot == NULL)) return; memset(slot, 0, sizeof(TmSlot)); - SC_ATOMIC_INIT(slot->slot_data); + SC_ATOMIC_INITPTR(slot->slot_data); slot->SlotThreadInit = tm->ThreadInit; slot->slot_initdata = data; if (tm->Func) { diff --git a/src/util-atomic.c b/src/util-atomic.c index 569f4c0a34..11aa51afd0 100644 --- a/src/util-atomic.c +++ b/src/util-atomic.c @@ -35,7 +35,8 @@ static int SCAtomicTest01(void) int b = 20; int *temp_int = NULL; - SC_ATOMIC_DECL_AND_INIT(void *, temp); + SC_ATOMIC_DECLARE(void *, temp); + SC_ATOMIC_INITPTR(temp); temp_int = SC_ATOMIC_GET(temp); if (temp_int != NULL) diff --git a/src/util-atomic.h b/src/util-atomic.h index 85d0a02935..410c1a4334 100644 --- a/src/util-atomic.h +++ b/src/util-atomic.h @@ -172,6 +172,9 @@ #define SC_ATOMIC_INIT(name) \ (name ## _sc_atomic__) = 0 +#define SC_ATOMIC_INITPTR(name) \ + (name ## _sc_atomic__) = NULL + /** * \brief wrapper for reinitializing an atomic variable. **/ diff --git a/src/util-var-name.c b/src/util-var-name.c index 3af35dc51e..3cc1231026 100644 --- a/src/util-var-name.c +++ b/src/util-var-name.c @@ -249,7 +249,7 @@ int VarNameStoreSetupStaging(uint32_t de_ctx_version) SCMutexLock(&g_varnamestore_staging_m); if (!initialized) { - SC_ATOMIC_INIT(g_varnamestore_current); + SC_ATOMIC_INITPTR(g_varnamestore_current); initialized = 1; }