From 415c992909a1623c1b9ffa565faa5dab7d4cdb2a Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Wed, 27 Nov 2019 20:03:44 +0100 Subject: [PATCH] util/mem: cleanup by moving atomic from mem hdr --- src/threadvars.h | 1 + src/util-debug.h | 2 ++ src/util-mem.c | 3 +++ src/util-mem.h | 4 ---- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/threadvars.h b/src/threadvars.h index ccf84960f9..c15d8c7b73 100644 --- a/src/threadvars.h +++ b/src/threadvars.h @@ -29,6 +29,7 @@ #include "counters.h" #include "threads.h" #include "packet-queue.h" +#include "util-atomic.h" struct TmSlot_; diff --git a/src/util-debug.h b/src/util-debug.h index ca2f552e2b..a2f0c601e8 100644 --- a/src/util-debug.h +++ b/src/util-debug.h @@ -30,6 +30,7 @@ #include "util-enum.h" #include "util-error.h" #include "util-debug-filters.h" +#include "util-atomic.h" /** * \brief ENV vars that can be used to set the properties for the logging module @@ -540,6 +541,7 @@ void SCLogErr(int x, const char *file, const char *func, const int line, * errors to be fatal errors */ #if !defined(__clang_analyzer__) #define FatalErrorOnInit(x, ...) do { \ + SC_ATOMIC_EXTERN(unsigned int, engine_stage); \ int init_errors_fatal = 0; \ ConfGetBool("engine.init-failure-fatal", &init_errors_fatal); \ if (init_errors_fatal && (SC_ATOMIC_GET(engine_stage) == SURICATA_INIT))\ diff --git a/src/util-mem.c b/src/util-mem.c index db06637d1d..381dc0557b 100644 --- a/src/util-mem.c +++ b/src/util-mem.c @@ -17,6 +17,9 @@ #include "suricata-common.h" #include "suricata.h" +#include "util-atomic.h" + +SC_ATOMIC_EXTERN(unsigned int, engine_stage); void *SCMallocFunc(const size_t sz) { diff --git a/src/util-mem.h b/src/util-mem.h index b761604560..e5c43cd844 100644 --- a/src/util-mem.h +++ b/src/util-mem.h @@ -31,8 +31,6 @@ #ifndef __UTIL_MEM_H__ #define __UTIL_MEM_H__ -#include "util-atomic.h" - #if CPPCHECK==1 || defined(__clang_analyzer__) #define SCMalloc malloc #define SCCalloc calloc @@ -49,8 +47,6 @@ #include "mm_malloc.h" #endif -SC_ATOMIC_EXTERN(unsigned int, engine_stage); - void *SCMallocFunc(const size_t sz); #define SCMalloc(sz) SCMallocFunc((sz))