X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frrdcached.c;h=0b9040536ecc165f0b9a85ea7bacd1d5866358d6;hb=d0408cb0dbef15d739a6b1cd047e9c94d7643329;hp=42fd3a34414969b139d8b0086c3016ebd7603f7b;hpb=f8232cfe5e140b6c89dbe736480ae547a0e04374;p=collectd.git diff --git a/src/rrdcached.c b/src/rrdcached.c index 42fd3a34..0b904053 100644 --- a/src/rrdcached.c +++ b/src/rrdcached.c @@ -25,6 +25,7 @@ **/ #include "collectd.h" + #include "plugin.h" #include "common.h" #include "utils_rrdcreate.h" @@ -69,7 +70,6 @@ static int value_list_to_string (char *buffer, int buffer_len, { int offset; int status; - int i; time_t t; assert (0 == strcmp (ds->type, vl->type)); @@ -82,7 +82,7 @@ static int value_list_to_string (char *buffer, int buffer_len, return (-1); offset = status; - for (i = 0; i < ds->ds_num; i++) + for (size_t i = 0; i < ds->ds_num; i++) { if ((ds->ds[i].type != DS_TYPE_COUNTER) && (ds->ds[i].type != DS_TYPE_GAUGE) @@ -95,7 +95,7 @@ static int value_list_to_string (char *buffer, int buffer_len, status = ssnprintf (buffer + offset, buffer_len - offset, ":%llu", vl->values[i].counter); } - else if (ds->ds[i].type == DS_TYPE_GAUGE) + else if (ds->ds[i].type == DS_TYPE_GAUGE) { status = ssnprintf (buffer + offset, buffer_len - offset, ":%f", vl->values[i].gauge); @@ -107,7 +107,7 @@ static int value_list_to_string (char *buffer, int buffer_len, else /* if (ds->ds[i].type == DS_TYPE_ABSOLUTE) */ { status = ssnprintf (buffer + offset, buffer_len - offset, ":%"PRIu64, vl->values[i].absolute); - + } if ((status < 1) || (status >= (buffer_len - offset))) @@ -217,9 +217,7 @@ static int rc_config_add_timespan (int timespan) static int rc_config (oconfig_item_t *ci) { - int i; - - for (i = 0; i < ci->children_num; i++) + for (int i = 0; i < ci->children_num; i++) { oconfig_item_t const *child = ci->children + i; const char *key = child->key; @@ -313,7 +311,6 @@ static int rc_read (void) { int status; rrdc_stats_t *head; - rrdc_stats_t *ptr; _Bool retried = 0; value_t values[1]; @@ -354,7 +351,7 @@ static int rc_read (void) if (status == 0) break; - if (! retried) + if (!retried) { retried = 1; if (try_reconnect () == 0) @@ -367,7 +364,7 @@ static int rc_read (void) return (-1); } - for (ptr = head; ptr != NULL; ptr = ptr->next) + for (rrdc_stats_t *ptr = head; ptr != NULL; ptr = ptr->next) { if (ptr->type == RRDC_STATS_TYPE_GAUGE) values[0].gauge = (gauge_t) ptr->value.gauge; @@ -526,7 +523,7 @@ static int rc_write (const data_set_t *ds, const value_list_t *vl, if (status == 0) break; - if (! retried) + if (!retried) { retried = 1; if (try_reconnect () == 0) @@ -576,7 +573,7 @@ static int rc_flush (__attribute__((unused)) cdtime_t timeout, /* {{{ */ if (status == 0) break; - if (! retried) + if (!retried) { retried = 1; if (try_reconnect () == 0)