From: Jason Ish Date: Mon, 26 Feb 2024 21:55:04 +0000 (-0600) Subject: suricata: remove instance from ParseCommandLine X-Git-Tag: suricata-8.0.0-beta1~1595 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=04bd026c5b8158498f3d29838024bcc8e9b9e2aa;p=thirdparty%2Fsuricata.git suricata: remove instance from ParseCommandLine We want to be able to call ParseCommandLine from library users, but currently library users don't have access to the `suricata` instance type. Since this var is used other places as a global, use the global one in ParseCommandLine as well. Not ideal, but isolating SCInstance to a non-global will be another challenge on its own. --- diff --git a/src/suricata.c b/src/suricata.c index fc88e7baf3..9d18fe6084 100644 --- a/src/suricata.c +++ b/src/suricata.c @@ -1312,8 +1312,9 @@ static bool IsLogDirectoryWritable(const char* str) extern int g_skip_prefilter; -static TmEcode ParseCommandLine(int argc, char** argv, SCInstance *suri) +static TmEcode ParseCommandLine(int argc, char **argv) { + SCInstance *suri = &suricata; int opt; int dump_config = 0; @@ -2899,7 +2900,7 @@ void SuricataPreInit(const char *progname) void SuricataInit(int argc, char **argv) { - if (ParseCommandLine(argc, argv, &suricata) != TM_ECODE_OK) { + if (ParseCommandLine(argc, argv) != TM_ECODE_OK) { exit(EXIT_FAILURE); }