X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frrdcached.c;h=0425419445d738a6e80992c77c51b229112ca173;hb=141816828389e3ad98f66db29b4a702479dcb05d;hp=645032cbe189686a707c7e6d34db7343432b8882;hpb=65c20e41cfad6e7ab024983f561835fd347124ce;p=collectd.git diff --git a/src/rrdcached.c b/src/rrdcached.c index 645032cb..04254194 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; @@ -293,7 +291,6 @@ static int rc_read (void) { int status; rrdc_stats_t *head; - rrdc_stats_t *ptr; value_t values[1]; value_list_t vl = VALUE_LIST_INIT; @@ -330,7 +327,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;