From: Brian Morris (bmorris2) Date: Fri, 14 Apr 2023 16:00:26 +0000 (+0000) Subject: Pull request #3809: src: fix broken unit test/tweak define related to previous operat... X-Git-Tag: 3.1.60.0~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d7fa1511378b86fd174d9f2d97766a94dcc84f22;p=thirdparty%2Fsnort3.git Pull request #3809: src: fix broken unit test/tweak define related to previous operator bool fixes Merge in SNORT/snort3 from ~BMORRIS2/snort3:cppcheck_operator to master Squashed commit of the following: commit 255884ac3dd41076a21b901a286fc1de9437abbd Author: Brian Morris Date: Fri Apr 14 14:52:20 2023 +0000 src: fix broken unit test/tweak define related to previous operator bool fixes --- diff --git a/src/detection/treenodes.h b/src/detection/treenodes.h index 0605f9661..3c1fd917d 100644 --- a/src/detection/treenodes.h +++ b/src/detection/treenodes.h @@ -74,7 +74,7 @@ struct OtnState uint64_t latency_suspends = 0; bool is_active() const - { return elapsed > 0_ticks || checks > 0; } + { return elapsed > CLOCK_ZERO || checks > 0; } }; /* function pointer list for rule head nodes */ diff --git a/src/profiler/rule_profiler.cc b/src/profiler/rule_profiler.cc index cc0a1b967..14220f0ea 100644 --- a/src/profiler/rule_profiler.cc +++ b/src/profiler/rule_profiler.cc @@ -504,7 +504,7 @@ TEST_CASE( "otn state", "[profiler][rule_profiler]" ) CHECK( true == state_a.is_active() ); OtnState state_c = OtnState(); - CHECK( true == state_c.is_active() ); + CHECK( false == state_c.is_active() ); state_c.elapsed = 1_ticks; CHECK( true == state_c.is_active() ); diff --git a/src/profiler/time_profiler_defs.h b/src/profiler/time_profiler_defs.h index 28b702212..6779ca5cf 100644 --- a/src/profiler/time_profiler_defs.h +++ b/src/profiler/time_profiler_defs.h @@ -62,7 +62,7 @@ struct SO_PUBLIC TimeProfilerStats { elapsed = 0_ticks; checks = 0; } bool is_active() const - { return ( elapsed > 0_ticks ) || checks; } + { return ( elapsed > CLOCK_ZERO ) || checks; } // reentrancy control bool enter() const { return ref_count++ == 0; }