X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fbarometer.c;h=fba3450a2aed5db5331cb6e82484916b54a29999;hb=43954e07f30d05b2da8319749400c9bf4d01c23c;hp=84ffdfcb0db74113b8bd18a4ae611df11c858834;hpb=6a68a39a2c6987fdcc94fb1bdd9cc8f598fd9478;p=collectd.git diff --git a/src/barometer.c b/src/barometer.c index 84ffdfcb..fba3450a 100644 --- a/src/barometer.c +++ b/src/barometer.c @@ -20,6 +20,7 @@ **/ #include "collectd.h" + #include "common.h" #include "utils_cache.h" #include "plugin.h" @@ -343,9 +344,9 @@ static temperature_list_t * temp_list = NULL; */ static int temp_list_add(temperature_list_t * list, const char * sensor) { - temperature_list_t * new_temp; + temperature_list_t *new_temp; - new_temp = (temperature_list_t *) malloc(sizeof(*new_temp)); + new_temp = malloc(sizeof (*new_temp)); if(new_temp == NULL) return -1; @@ -407,7 +408,6 @@ static int get_reference_temperature(double * result) gauge_t * values = NULL; /**< rate values */ size_t values_num = 0; /**< number of rate values */ - int i; gauge_t values_history[REF_TEMP_AVG_NUM]; @@ -445,11 +445,10 @@ static int get_reference_temperature(double * result) list->initialized = 1; list->num_values = values_num; - for(i=0; inum_values; ++i) + for(size_t i=0; inum_values; ++i) { - DEBUG ("barometer: get_reference_temperature - history %d: %lf", - i, - values_history[i]); + DEBUG ("barometer: get_reference_temperature - history %zu: %lf", + i, values_history[i]); if(!isnan(values_history[i])) { avg_sum += values_history[i]; @@ -501,11 +499,10 @@ static int get_reference_temperature(double * result) continue; } - for(i=0; i