]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Pull request #3809: src: fix broken unit test/tweak define related to previous operat...
authorBrian Morris (bmorris2) <bmorris2@cisco.com>
Fri, 14 Apr 2023 16:00:26 +0000 (16:00 +0000)
committerBrian Morris (bmorris2) <bmorris2@cisco.com>
Fri, 14 Apr 2023 16:00:26 +0000 (16:00 +0000)
Merge in SNORT/snort3 from ~BMORRIS2/snort3:cppcheck_operator to master

Squashed commit of the following:

commit 255884ac3dd41076a21b901a286fc1de9437abbd
Author: Brian Morris <bmorris2@cisco.com>
Date:   Fri Apr 14 14:52:20 2023 +0000

    src: fix broken unit test/tweak define related to previous operator bool fixes

src/detection/treenodes.h
src/profiler/rule_profiler.cc
src/profiler/time_profiler_defs.h

index 0605f96615cc3537a650f38024878cf0da9f6d85..3c1fd917de50edd54e2fb929967a16692fce7c77 100644 (file)
@@ -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 */
index cc0a1b967f1013de619c3ee8f9efeaf828116858..14220f0ea750967833f6ce95cd831da3272afaed 100644 (file)
@@ -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() );
index 28b70221275fb3a2fe3e324eaf78192dca07ca75..6779ca5cfd29a4cd44f2ece681a3b0f111835e8e 100644 (file)
@@ -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; }