X-Git-Url: https://git.octo.it/?a=blobdiff_plain;ds=sidebyside;f=src%2Flibcollectdclient%2Fclient.c;fp=src%2Flibcollectdclient%2Fclient.c;h=1c118e3c621ac7d51efb20a12d801308d3818bdb;hb=2761915bed8c6caea41018be3e675aa712cc0b0a;hp=cd333cc3ced478baf8c445a623e4dda114bbca43;hpb=cd2238b8b4f4ecd80c45862b5aeed3d3d73eddfe;p=collectd.git diff --git a/src/libcollectdclient/client.c b/src/libcollectdclient/client.c index cd333cc3..1c118e3c 100644 --- a/src/libcollectdclient/client.c +++ b/src/libcollectdclient/client.c @@ -235,12 +235,10 @@ static void lcc_chomp (char *str) /* {{{ */ static void lcc_response_free (lcc_response_t *res) /* {{{ */ { - size_t i; - if (res == NULL) return; - for (i = 0; i < res->lines_num; i++) + for (size_t i = 0; i < res->lines_num; i++) free (res->lines[i]); free (res->lines); res->lines = NULL; @@ -421,7 +419,6 @@ static int lcc_open_netsocket (lcc_connection_t *c, /* {{{ */ const char *addr_orig) { struct addrinfo *ai_res; - struct addrinfo *ai_ptr; char addr_copy[NI_MAXHOST]; char *addr; char *port; @@ -486,7 +483,7 @@ static int lcc_open_netsocket (lcc_connection_t *c, /* {{{ */ return (-1); } - for (ai_ptr = ai_res; ai_ptr != NULL; ai_ptr = ai_ptr->ai_next) + for (struct addrinfo *ai_ptr = ai_res; ai_ptr != NULL; ai_ptr = ai_ptr->ai_next) { fd = socket (ai_ptr->ai_family, ai_ptr->ai_socktype, ai_ptr->ai_protocol); if (fd < 0) @@ -741,7 +738,6 @@ int lcc_putval (lcc_connection_t *c, const lcc_value_list_t *vl) /* {{{ */ char command[1024] = ""; lcc_response_t res; int status; - size_t i; if ((c == NULL) || (vl == NULL) || (vl->values_len < 1) || (vl->values == NULL) || (vl->values_types == NULL)) @@ -766,7 +762,7 @@ int lcc_putval (lcc_connection_t *c, const lcc_value_list_t *vl) /* {{{ */ else SSTRCAT (command, " N"); - for (i = 0; i < vl->values_len; i++) + for (size_t i = 0; i < vl->values_len; i++) { if (vl->values_types[i] == LCC_TYPE_COUNTER) SSTRCATF (command, ":%"PRIu64, vl->values[i].counter); @@ -858,7 +854,6 @@ int lcc_listval (lcc_connection_t *c, /* {{{ */ lcc_identifier_t **ret_ident, size_t *ret_ident_num) { lcc_response_t res; - size_t i; int status; lcc_identifier_t *ident; @@ -893,7 +888,7 @@ int lcc_listval (lcc_connection_t *c, /* {{{ */ return (-1); } - for (i = 0; i < res.lines_num; i++) + for (size_t i = 0; i < res.lines_num; i++) { char *time_str; char *ident_str;