]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
remove silliness to limit strings output in example so
authorRuss Combs <rucombs@cisco.com>
Mon, 11 Aug 2014 10:41:03 +0000 (06:41 -0400)
committerRuss Combs <rucombs@cisco.com>
Mon, 11 Aug 2014 10:41:03 +0000 (06:41 -0400)
extra/src/so_rules/sid_18758.cc

index 9c99b39cd206618e6bc1d58ade28961608e0f2cd..cb9926406d842d14bf6d78b940e43cb797aff0c6 100644 (file)
 #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 =