]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
write_riemann_threshold.c: fix switch-case fall through warning 3917/head
authorEero Tamminen <eero.t.tamminen@intel.com>
Wed, 17 Jan 2024 15:28:07 +0000 (17:28 +0200)
committerEero Tamminen <eero.t.tamminen@intel.com>
Fri, 19 Jan 2024 17:07:16 +0000 (19:07 +0200)
Checking also warning limits was just executing redundant code, but
otherwise harmless as later code checks failure count first.

Signed-off-by: Eero Tamminen <eero.t.tamminen@intel.com>
src/write_riemann_threshold.c

index 9968c44518e76e1e37fd36ede04df83f4f56a844..54a7e5bd38b3c64346f89efda2fd9d8a1cf3dd97 100644 (file)
@@ -83,16 +83,16 @@ static int ut_check_one_data_source(
           (!isnan(th->failure_max) &&
            ((th->failure_max - th->hysteresis) > values[ds_index])))
         return STATE_OKAY;
-      else
-        is_failure++;
+      is_failure++;
+      break;
     case STATE_WARNING:
       if ((!isnan(th->warning_min) &&
            ((th->warning_min + th->hysteresis) < values[ds_index])) ||
           (!isnan(th->warning_max) &&
            ((th->warning_max - th->hysteresis) > values[ds_index])))
         return STATE_OKAY;
-      else
-        is_warning++;
+      is_warning++;
+      break;
     }
   } else { /* no hysteresis */
     if ((!isnan(th->failure_min) && (th->failure_min > values[ds_index])) ||