From: Russ Combs Date: Mon, 11 Aug 2014 10:41:03 +0000 (-0400) Subject: remove silliness to limit strings output in example so X-Git-Tag: 3.0.0-233~1426^2~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c3fd6c00c16480036d4933bce4eb266ef498e727;p=thirdparty%2Fsnort3.git remove silliness to limit strings output in example so --- diff --git a/extra/src/so_rules/sid_18758.cc b/extra/src/so_rules/sid_18758.cc index 9c99b39cd..cb9926406 100644 --- a/extra/src/so_rules/sid_18758.cc +++ b/extra/src/so_rules/sid_18758.cc @@ -32,27 +32,25 @@ #include "detection/detection_defines.h" #include "sid_18758.h" -static constexpr unsigned crash_test_dummy = 18758; - -static int eval(void* v, Packet* p) +static int eval(void*, Packet* p) { - unsigned u = *((unsigned*)v); - assert(u == crash_test_dummy); return p ? DETECTION_OPTION_MATCH : DETECTION_OPTION_NO_MATCH; } -static SoEvalFunc ctor(const char* so, void** pv) +static SoEvalFunc ctor(const char* /*so*/, void** pv) { - assert(!strcmp(so, "eval")); - *pv = new unsigned(crash_test_dummy); + // so == "eval" here because that's our only so: option + // but we could use multiple so: options and bind to + // different functions based on the value of so + // *pv can point to any data we need to use with so + *pv = nullptr; return eval; } -static void dtor(void* v) +static void dtor(void* /*pv*/) { - unsigned* u = (unsigned*)v; - assert(*u == crash_test_dummy); - delete u; + // cast pv to your type here + // and then delete it } static const SoApi so_api =