projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #1842 from rubenk/declare-loop-variable-in-for-loop-controlling...
[collectd.git]
/
src
/
gmond.c
diff --git
a/src/gmond.c
b/src/gmond.c
index
cfe7eaf
..
2b299ca
100644
(file)
--- a/
src/gmond.c
+++ b/
src/gmond.c
@@
-25,6
+25,7
@@
**/
#include "collectd.h"
**/
#include "collectd.h"
+
#include "plugin.h"
#include "common.h"
#include "configfile.h"
#include "plugin.h"
#include "common.h"
#include "configfile.h"
@@
-212,7
+213,6
@@
static int create_sockets (socket_entry_t **ret_sockets, /* {{{ */
const char *node, const char *service, int listen)
{
struct addrinfo *ai_list;
const char *node, const char *service, int listen)
{
struct addrinfo *ai_list;
- struct addrinfo *ai_ptr;
int ai_return;
socket_entry_t *sockets = NULL;
int ai_return;
socket_entry_t *sockets = NULL;
@@
-243,7
+243,7
@@
static int create_sockets (socket_entry_t **ret_sockets, /* {{{ */
return (-1);
}
return (-1);
}
- for (ai_ptr = ai_list; ai_ptr != NULL; ai_ptr = ai_ptr->ai_next) /* {{{ */
+ for (
struct addrinfo *
ai_ptr = ai_list; ai_ptr != NULL; ai_ptr = ai_ptr->ai_next) /* {{{ */
{
socket_entry_t *tmp;
{
socket_entry_t *tmp;
@@
-397,7
+397,6
@@
static int request_meta_data (const char *host, const char *name) /* {{{ */
char buffer[BUFF_SIZE] = { 0 };
unsigned int buffer_size;
XDR xdr;
char buffer[BUFF_SIZE] = { 0 };
unsigned int buffer_size;
XDR xdr;
- size_t i;
msg.id = gmetadata_request;
msg.Ganglia_metadata_msg_u.grequest.metric_id.host = strdup (host);
msg.id = gmetadata_request;
msg.Ganglia_metadata_msg_u.grequest.metric_id.host = strdup (host);
@@
-426,7
+425,7
@@
static int request_meta_data (const char *host, const char *name) /* {{{ */
host, name);
pthread_mutex_lock (&mc_send_sockets_lock);
host, name);
pthread_mutex_lock (&mc_send_sockets_lock);
- for (i = 0; i < mc_send_sockets_num; i++)
+ for (
size_t
i = 0; i < mc_send_sockets_num; i++)
{
ssize_t status = sendto (mc_send_sockets[i].fd, buffer, (size_t) buffer_size,
/* flags = */ 0,
{
ssize_t status = sendto (mc_send_sockets[i].fd, buffer, (size_t) buffer_size,
/* flags = */ 0,
@@
-828,7
+827,6
@@
static void *mc_receive_thread (void *arg) /* {{{ */
{
socket_entry_t *mc_receive_socket_entries;
int status;
{
socket_entry_t *mc_receive_socket_entries;
int status;
- size_t i;
mc_receive_socket_entries = NULL;
status = create_sockets (&mc_receive_socket_entries, &mc_receive_sockets_num,
mc_receive_socket_entries = NULL;
status = create_sockets (&mc_receive_socket_entries, &mc_receive_sockets_num,
@@
-846,7
+844,7
@@
static void *mc_receive_thread (void *arg) /* {{{ */
if (mc_receive_sockets == NULL)
{
ERROR ("gmond plugin: calloc failed.");
if (mc_receive_sockets == NULL)
{
ERROR ("gmond plugin: calloc failed.");
- for (i = 0; i < mc_receive_sockets_num; i++)
+ for (
size_t
i = 0; i < mc_receive_sockets_num; i++)
close (mc_receive_socket_entries[i].fd);
free (mc_receive_socket_entries);
mc_receive_socket_entries = NULL;
close (mc_receive_socket_entries[i].fd);
free (mc_receive_socket_entries);
mc_receive_socket_entries = NULL;
@@
-854,7
+852,7
@@
static void *mc_receive_thread (void *arg) /* {{{ */
return ((void *) -1);
}
return ((void *) -1);
}
- for (i = 0; i < mc_receive_sockets_num; i++)
+ for (
size_t
i = 0; i < mc_receive_sockets_num; i++)
{
mc_receive_sockets[i].fd = mc_receive_socket_entries[i].fd;
mc_receive_sockets[i].events = POLLIN | POLLPRI;
{
mc_receive_sockets[i].fd = mc_receive_socket_entries[i].fd;
mc_receive_sockets[i].events = POLLIN | POLLPRI;
@@
-874,7
+872,7
@@
static void *mc_receive_thread (void *arg) /* {{{ */
break;
}
break;
}
- for (i = 0; i < mc_receive_sockets_num; i++)
+ for (
size_t
i = 0; i < mc_receive_sockets_num; i++)
{
if (mc_receive_sockets[i].revents != 0)
mc_handle_socket (mc_receive_sockets + i);
{
if (mc_receive_sockets[i].revents != 0)
mc_handle_socket (mc_receive_sockets + i);
@@
-962,7
+960,6
@@
static int gmond_config_set_string (oconfig_item_t *ci, char **str) /* {{{ */
static int gmond_config_add_metric (oconfig_item_t *ci) /* {{{ */
{
metric_map_t *map;
static int gmond_config_add_metric (oconfig_item_t *ci) /* {{{ */
{
metric_map_t *map;
- int i;
if ((ci->values_num != 1) || (ci->values[0].type != OCONFIG_TYPE_STRING))
{
if ((ci->values_num != 1) || (ci->values[0].type != OCONFIG_TYPE_STRING))
{
@@
-994,7
+991,7
@@
static int gmond_config_add_metric (oconfig_item_t *ci) /* {{{ */
return (-1);
}
return (-1);
}
- for (i = 0; i < ci->children_num; i++)
+ for (i
nt i
= 0; i < ci->children_num; i++)
{
oconfig_item_t *child = ci->children + i;
if (strcasecmp ("Type", child->key) == 0)
{
oconfig_item_t *child = ci->children + i;
if (strcasecmp ("Type", child->key) == 0)
@@
-1071,9
+1068,7
@@
static int gmond_config_set_address (oconfig_item_t *ci, /* {{{ */
static int gmond_config (oconfig_item_t *ci) /* {{{ */
{
static int gmond_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 *child = ci->children + i;
if (strcasecmp ("MCReceiveFrom", child->key) == 0)
{
oconfig_item_t *child = ci->children + i;
if (strcasecmp ("MCReceiveFrom", child->key) == 0)
@@
-1111,12
+1106,10
@@
static int gmond_init (void) /* {{{ */
static int gmond_shutdown (void) /* {{{ */
{
static int gmond_shutdown (void) /* {{{ */
{
- size_t i;
-
mc_receive_thread_stop ();
pthread_mutex_lock (&mc_send_sockets_lock);
mc_receive_thread_stop ();
pthread_mutex_lock (&mc_send_sockets_lock);
- for (i = 0; i < mc_send_sockets_num; i++)
+ for (
size_t
i = 0; i < mc_send_sockets_num; i++)
{
close (mc_send_sockets[i].fd);
mc_send_sockets[i].fd = -1;
{
close (mc_send_sockets[i].fd);
mc_send_sockets[i].fd = -1;