From e63bbf57d881affc3f499a77af24271955bc01de Mon Sep 17 00:00:00 2001 From: Philippe Antoine Date: Fri, 25 Sep 2026 14:46:10 +0200 Subject: [PATCH] src: remove unused variables Example of warning by new clang: runmodes.c:537:12: warning: variable 'file_logger_count' set but not used [-Wunused-but-set-global] 537 | static int file_logger_count = 0; --- src/detect-file-data.c | 3 --- src/detect-filename.c | 2 -- src/detect-uricontent.c | 4 ---- src/runmodes.c | 3 --- src/source-lib.c | 4 ---- 5 files changed, 16 deletions(-) diff --git a/src/detect-file-data.c b/src/detect-file-data.c index c8b01aed20..ef9911ac21 100644 --- a/src/detect-file-data.c +++ b/src/detect-file-data.c @@ -60,7 +60,6 @@ static void DetectFiledataRegisterTests(void); #endif static void DetectFiledataSetupCallback( const DetectEngineCtx *de_ctx, Signature *s, const DetectBufferType *map); -static int g_file_data_buffer_id = 0; /* file API */ int PrefilterMpmFiledataRegister(DetectEngineCtx *de_ctx, SigGroupHead *sgh, MpmCtx *mpm_ctx, @@ -172,8 +171,6 @@ void DetectFiledataRegister(void) DetectBufferTypeSetDescriptionByName("file_data", "data from tracked files"); DetectBufferTypeSupportsMultiInstance("file_data"); - - g_file_data_buffer_id = DetectBufferTypeGetByName("file_data"); } static void SetupDetectEngineConfig(DetectEngineCtx *de_ctx) { diff --git a/src/detect-filename.c b/src/detect-filename.c index a901aeed43..4490502fbe 100644 --- a/src/detect-filename.c +++ b/src/detect-filename.c @@ -65,7 +65,6 @@ static int DetectFilenameSetupSticky(DetectEngineCtx *de_ctx, Signature *s, cons #ifdef UNITTESTS static void DetectFilenameRegisterTests(void); #endif -static int g_file_match_list_id = 0; static int g_file_name_buffer_id = 0; static int PrefilterMpmFilenameRegister(DetectEngineCtx *de_ctx, SigGroupHead *sgh, MpmCtx *mpm_ctx, @@ -105,7 +104,6 @@ void DetectFilenameRegister(void) DetectBufferTypeSetDescriptionByName("file.name", "file name"); - g_file_match_list_id = DetectBufferTypeRegister("files"); g_file_name_buffer_id = DetectBufferTypeRegister("file.name"); SCLogDebug("registering filename rule option"); diff --git a/src/detect-uricontent.c b/src/detect-uricontent.c index aaa9d9d1e4..e9a5a86560 100644 --- a/src/detect-uricontent.c +++ b/src/detect-uricontent.c @@ -59,8 +59,6 @@ static int DetectUricontentSetup(DetectEngineCtx *, Signature *, const char *); static void DetectUricontentFree(DetectEngineCtx *de_ctx, void *); -static int g_http_uri_buffer_id = 0; - /** * \brief Registration function for uricontent: keyword */ @@ -74,8 +72,6 @@ void DetectUricontentRegister (void) sigmatch_table[DETECT_URICONTENT].Free = DetectUricontentFree; sigmatch_table[DETECT_URICONTENT].flags = (SIGMATCH_QUOTES_MANDATORY|SIGMATCH_HANDLE_NEGATION); sigmatch_table[DETECT_URICONTENT].alternative = DETECT_HTTP_URI; - - g_http_uri_buffer_id = DetectBufferTypeRegister("http_uri"); } /** diff --git a/src/runmodes.c b/src/runmodes.c index 278ad83c8e..fc8b3f6886 100644 --- a/src/runmodes.c +++ b/src/runmodes.c @@ -534,7 +534,6 @@ static void RunOutputFreeList(void) } } -static int file_logger_count = 0; static int filedata_logger_count = 0; int RunModeOutputFiledataEnabled(void) @@ -588,7 +587,6 @@ void RunModeShutDown(void) OutputClearActiveLoggers(); /* Reset logger counts. */ - file_logger_count = 0; filedata_logger_count = 0; } @@ -656,7 +654,6 @@ static void SetupOutput( SCLogDebug("%s is a file logger", module->name); SCOutputRegisterFileLogger(module->logger_id, module->name, module->FileLogFunc, output_ctx, module->ThreadInit, module->ThreadDeinit); - file_logger_count++; } else if (module->StreamingLogFunc) { SCLogDebug("%s is a streaming logger", module->name); SCOutputRegisterStreamingLogger(module->logger_id, module->name, module->StreamingLogFunc, diff --git a/src/source-lib.c b/src/source-lib.c index 360cb546c2..c2eb69f0b5 100644 --- a/src/source-lib.c +++ b/src/source-lib.c @@ -27,9 +27,6 @@ #include "source-lib.h" #include "util-device-private.h" -/* Set time to the first packet timestamp when replaying a PCAP. */ -static bool time_set = false; - /** \brief initialize the "Decode" module. * * \param tv Pointer to the per-thread structure. @@ -65,7 +62,6 @@ static TmEcode DecodeLibThreadDeinit(ThreadVars *tv, void *data) if (data != NULL) DecodeThreadVarsFree(tv, data); - time_set = false; SCReturnInt(TM_ECODE_OK); }