X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fthreshold.c;h=77ba3f324b6e425afb4233fe0526b1cb86afdf8c;hb=005a70ad7863229b8c60e8ca83b67e89dfb05ad0;hp=a5e50a22ffe5e9209049331155e6dc3f467014e9;hpb=6258e772d808f4e76ea8e23d9e2750cfc7e6c60d;p=collectd.git diff --git a/src/threshold.c b/src/threshold.c index a5e50a22..77ba3f32 100644 --- a/src/threshold.c +++ b/src/threshold.c @@ -30,9 +30,6 @@ #include "utils_cache.h" #include "utils_threshold.h" -#include -#include - /* * Threshold management * ==================== @@ -70,7 +67,7 @@ static int ut_threshold_add (const threshold_t *th) return (-1); } - th_copy = (threshold_t *) malloc (sizeof (threshold_t)); + th_copy = malloc (sizeof (*th_copy)); if (th_copy == NULL) { sfree (name_copy); @@ -78,7 +75,6 @@ static int ut_threshold_add (const threshold_t *th) return (-1); } memcpy (th_copy, th, sizeof (threshold_t)); - th_ptr = NULL; DEBUG ("ut_threshold_add: Adding entry `%s'", name); @@ -553,7 +549,7 @@ static int ut_report_state (const data_set_t *ds, { gauge_t value; gauge_t sum; - int i; + size_t i; sum = 0.0; for (i = 0; i < vl->values_len; i++) @@ -701,7 +697,7 @@ static int ut_check_one_threshold (const data_set_t *ds, { /* {{{ */ int ret = -1; int ds_index = -1; - int i; + size_t i; gauge_t values_copy[ds->ds_num]; memcpy (values_copy, values, sizeof (values_copy)); @@ -868,7 +864,7 @@ static int ut_missing (const value_list_t *vl, return (0); } /* }}} int ut_missing */ -int ut_config (oconfig_item_t *ci) +static int ut_config (oconfig_item_t *ci) { /* {{{ */ int i; int status = 0; @@ -878,7 +874,7 @@ int ut_config (oconfig_item_t *ci) 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.");