X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fthreshold.c;h=bbd4091371dcf0f88c695d1650b3447cfe5631fa;hb=aef788ac8927ffa74429daaffb572566fae782ec;hp=e849b1d8b921fd2da5d7d1f3f98eaf20d7a07e2a;hpb=0d80072344ea5322c34f716ed77a5319a62bfc96;p=collectd.git diff --git a/src/threshold.c b/src/threshold.c index e849b1d8..bbd40913 100644 --- a/src/threshold.c +++ b/src/threshold.c @@ -24,15 +24,13 @@ **/ #include "collectd.h" + #include "common.h" #include "plugin.h" #include "utils_avltree.h" #include "utils_cache.h" #include "utils_threshold.h" -#include -#include - /* * Threshold management * ==================== @@ -873,11 +871,9 @@ static int ut_config (oconfig_item_t *ci) int status = 0; int old_size = c_avl_size (threshold_tree); - threshold_t th; - if (threshold_tree == NULL) { - threshold_tree = c_avl_create ((void *) strcmp); + threshold_tree = c_avl_create ((int (*) (const void *, const void *)) strcmp); if (threshold_tree == NULL) { ERROR ("ut_config: c_avl_create failed."); @@ -885,15 +881,13 @@ static int ut_config (oconfig_item_t *ci) } } - memset (&th, '\0', sizeof (th)); - th.warning_min = NAN; - th.warning_max = NAN; - th.failure_min = NAN; - th.failure_max = NAN; - - th.hits = 0; - th.hysteresis = 0; - th.flags = UT_FLAG_INTERESTING; /* interesting by default */ + threshold_t th = { + .warning_min = NAN, + .warning_max = NAN, + .failure_min = NAN, + .failure_max = NAN, + .flags = UT_FLAG_INTERESTING /* interesting by default */ + }; for (i = 0; i < ci->children_num; i++) {