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 #1856 from rubenk/snmp-dont-dispatch-values-with-empty-type-instance
[collectd.git]
/
src
/
statsd.c
diff --git
a/src/statsd.c
b/src/statsd.c
index
285486d
..
040181a
100644
(file)
--- a/
src/statsd.c
+++ b/
src/statsd.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"
@@
-500,8
+501,7
@@
static int statsd_network_init (struct pollfd **ret_fds, /* {{{ */
struct pollfd *fds = NULL;
size_t fds_num = 0;
struct pollfd *fds = NULL;
size_t fds_num = 0;
- struct addrinfo *ai_list = NULL;
- struct addrinfo *ai_ptr;
+ struct addrinfo *ai_list;
int status;
char const *node = (conf_node != NULL) ? conf_node : STATSD_DEFAULT_NODE;
int status;
char const *node = (conf_node != NULL) ? conf_node : STATSD_DEFAULT_NODE;
@@
-522,7
+522,7
@@
static int statsd_network_init (struct pollfd **ret_fds, /* {{{ */
return (status);
}
return (status);
}
- 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)
{
int fd;
struct pollfd *tmp;
{
int fd;
struct pollfd *tmp;
@@
-589,7
+589,6
@@
static void *statsd_network_thread (void *args) /* {{{ */
struct pollfd *fds = NULL;
size_t fds_num = 0;
int status;
struct pollfd *fds = NULL;
size_t fds_num = 0;
int status;
- size_t i;
status = statsd_network_init (&fds, &fds_num);
if (status != 0)
status = statsd_network_init (&fds, &fds_num);
if (status != 0)
@@
-613,7
+612,7
@@
static void *statsd_network_thread (void *args) /* {{{ */
break;
}
break;
}
- for (i = 0; i < fds_num; i++)
+ for (
size_t
i = 0; i < fds_num; i++)
{
if ((fds[i].revents & (POLLIN | POLLPRI)) == 0)
continue;
{
if ((fds[i].revents & (POLLIN | POLLPRI)) == 0)
continue;
@@
-624,7
+623,7
@@
static void *statsd_network_thread (void *args) /* {{{ */
} /* while (!network_thread_shutdown) */
/* Clean up */
} /* while (!network_thread_shutdown) */
/* Clean up */
- for (i = 0; i < fds_num; i++)
+ for (
size_t
i = 0; i < fds_num; i++)
close (fds[i].fd);
sfree (fds);
close (fds[i].fd);
sfree (fds);
@@
-664,9
+663,7
@@
static int statsd_config_timer_percentile (oconfig_item_t *ci) /* {{{ */
static int statsd_config (oconfig_item_t *ci) /* {{{ */
{
static int statsd_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;
{
oconfig_item_t *child = ci->children + i;
@@
-779,7
+776,6
@@
static int statsd_metric_submit_unsafe (char const *name, statsd_metric_t *metri
values[0].gauge = (gauge_t) metric->value;
else if (metric->type == STATSD_TIMER)
{
values[0].gauge = (gauge_t) metric->value;
else if (metric->type == STATSD_TIMER)
{
- size_t i;
_Bool have_events = (metric->updates_num > 0);
/* Make sure all timer metrics share the *same* timestamp. */
_Bool have_events = (metric->updates_num > 0);
/* Make sure all timer metrics share the *same* timestamp. */
@@
-819,7
+815,7
@@
static int statsd_metric_submit_unsafe (char const *name, statsd_metric_t *metri
plugin_dispatch_values (&vl);
}
plugin_dispatch_values (&vl);
}
- for (i = 0; i < conf_timer_percentile_num; i++)
+ for (
size_t
i = 0; i < conf_timer_percentile_num; i++)
{
ssnprintf (vl.type_instance, sizeof (vl.type_instance),
"%s-percentile-%.0f", name, conf_timer_percentile[i]);
{
ssnprintf (vl.type_instance, sizeof (vl.type_instance),
"%s-percentile-%.0f", name, conf_timer_percentile[i]);
@@
-885,7
+881,6
@@
static int statsd_read (void) /* {{{ */
char **to_be_deleted = NULL;
size_t to_be_deleted_num = 0;
char **to_be_deleted = NULL;
size_t to_be_deleted_num = 0;
- size_t i;
pthread_mutex_lock (&metrics_lock);
pthread_mutex_lock (&metrics_lock);
@@
-920,7
+915,7
@@
static int statsd_read (void) /* {{{ */
}
c_avl_iterator_destroy (iter);
}
c_avl_iterator_destroy (iter);
- for (i = 0; i < to_be_deleted_num; i++)
+ for (
size_t
i = 0; i < to_be_deleted_num; i++)
{
int status;
{
int status;