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
/
write_tsdb.c
diff --git
a/src/write_tsdb.c
b/src/write_tsdb.c
index
7a8f851
..
309418a
100644
(file)
--- a/
src/write_tsdb.c
+++ b/
src/write_tsdb.c
@@
-42,6
+42,7
@@
*/
#include "collectd.h"
*/
#include "collectd.h"
+
#include "common.h"
#include "plugin.h"
#include "configfile.h"
#include "common.h"
#include "plugin.h"
#include "configfile.h"
@@
-155,9
+156,7
@@
static int wt_flush_nolock(cdtime_t timeout, struct wt_callback *cb)
static int wt_callback_init(struct wt_callback *cb)
{
static int wt_callback_init(struct wt_callback *cb)
{
- struct addrinfo ai_hints = { 0 };
struct addrinfo *ai_list;
struct addrinfo *ai_list;
- struct addrinfo *ai_ptr;
int status;
const char *node = cb->node ? cb->node : WT_DEFAULT_NODE;
int status;
const char *node = cb->node ? cb->node : WT_DEFAULT_NODE;
@@
-166,11
+165,11
@@
static int wt_callback_init(struct wt_callback *cb)
if (cb->sock_fd > 0)
return 0;
if (cb->sock_fd > 0)
return 0;
- ai_hints.ai_flags = AI_ADDRCONFIG;
- ai_hints.ai_family = AF_UNSPEC;
- ai_hints.ai_socktype = SOCK_STREAM;
-
-
ai_list = NULL
;
+ struct addrinfo ai_hints = {
+ .ai_family = AF_UNSPEC,
+ .ai_flags = AI_ADDRCONFIG,
+ .ai_socktype = SOCK_STREAM
+
}
;
status = getaddrinfo(node, service, &ai_hints, &ai_list);
if (status != 0)
status = getaddrinfo(node, service, &ai_hints, &ai_list);
if (status != 0)
@@
-181,7
+180,7
@@
static int wt_callback_init(struct wt_callback *cb)
}
assert (ai_list != NULL);
}
assert (ai_list != NULL);
- 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)
{
cb->sock_fd = socket(ai_ptr->ai_family, ai_ptr->ai_socktype,
ai_ptr->ai_protocol);
{
cb->sock_fd = socket(ai_ptr->ai_family, ai_ptr->ai_socktype,
ai_ptr->ai_protocol);
@@
-503,7
+502,6
@@
static int wt_write_messages(const data_set_t *ds, const value_list_t *vl,
char values[512];
int status;
char values[512];
int status;
- size_t i;
if (0 != strcmp(ds->type, vl->type))
{
if (0 != strcmp(ds->type, vl->type))
{
@@
-512,7
+510,7
@@
static int wt_write_messages(const data_set_t *ds, const value_list_t *vl,
return -1;
}
return -1;
}
- for (i = 0; i < ds->ds_num; i++)
+ for (
size_t
i = 0; i < ds->ds_num; i++)
{
const char *ds_name = NULL;
{
const char *ds_name = NULL;
@@
-573,7
+571,6
@@
static int wt_config_tsd(oconfig_item_t *ci)
struct wt_callback *cb;
user_data_t user_data = { 0 };
char callback_name[DATA_MAX_NAME_LEN];
struct wt_callback *cb;
user_data_t user_data = { 0 };
char callback_name[DATA_MAX_NAME_LEN];
- int i;
cb = calloc(1, sizeof(*cb));
if (cb == NULL)
cb = calloc(1, sizeof(*cb));
if (cb == NULL)
@@
-589,7
+586,7
@@
static int wt_config_tsd(oconfig_item_t *ci)
pthread_mutex_init (&cb->send_lock, NULL);
pthread_mutex_init (&cb->send_lock, NULL);
- 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;
{
oconfig_item_t *child = ci->children + i;
@@
-626,9
+623,7
@@
static int wt_config_tsd(oconfig_item_t *ci)
static int wt_config(oconfig_item_t *ci)
{
static int wt_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;