projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix double declaration
[collectd.git]
/
src
/
write_tsdb.c
diff --git
a/src/write_tsdb.c
b/src/write_tsdb.c
index
2ed4389
..
a044b68
100644
(file)
--- a/
src/write_tsdb.c
+++ b/
src/write_tsdb.c
@@
-48,7
+48,6
@@
#include "utils_cache.h"
#include "utils_cache.h"
-#include <pthread.h>
#include <netdb.h>
#ifndef WT_DEFAULT_NODE
#include <netdb.h>
#ifndef WT_DEFAULT_NODE
@@
-142,7
+141,7
@@
static int wt_flush_nolock(cdtime_t timeout, struct wt_callback *cb)
return 0;
}
return 0;
}
- if (cb->send_buf_fill
<
= 0)
+ if (cb->send_buf_fill
=
= 0)
{
cb->send_buf_init_time = cdtime();
return 0;
{
cb->send_buf_init_time = cdtime();
return 0;
@@
-156,7
+155,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;
+ struct addrinfo ai_hints
= { 0 }
;
struct addrinfo *ai_list;
struct addrinfo *ai_ptr;
int status;
struct addrinfo *ai_list;
struct addrinfo *ai_ptr;
int status;
@@
-167,7
+166,6
@@
static int wt_callback_init(struct wt_callback *cb)
if (cb->sock_fd > 0)
return 0;
if (cb->sock_fd > 0)
return 0;
- memset(&ai_hints, 0, sizeof(ai_hints));
#ifdef AI_ADDRCONFIG
ai_hints.ai_flags |= AI_ADDRCONFIG;
#endif
#ifdef AI_ADDRCONFIG
ai_hints.ai_flags |= AI_ADDRCONFIG;
#endif
@@
-346,7
+344,7
@@
static int wt_format_name(char *ret, int ret_len,
{
int status;
char *temp = NULL;
{
int status;
char *temp = NULL;
- char *prefix = "";
+ c
onst c
har *prefix = "";
const char *meta_prefix = "tsdb_prefix";
if (vl->meta) {
const char *meta_prefix = "tsdb_prefix";
if (vl->meta) {
@@
-411,9
+409,9
@@
static int wt_send_message (const char* key, const char* value,
int status;
size_t message_len;
char *temp = NULL;
int status;
size_t message_len;
char *temp = NULL;
- char *tags = "";
+ c
onst c
har *tags = "";
char message[1024];
char message[1024];
- char *host_tags = cb->host_tags ? cb->host_tags : "";
+ c
onst c
har *host_tags = cb->host_tags ? cb->host_tags : "";
const char *meta_tsdb = "tsdb_tags";
/* skip if value is NaN */
const char *meta_tsdb = "tsdb_tags";
/* skip if value is NaN */
@@
-575,17
+573,16
@@
static int wt_write(const data_set_t *ds, const value_list_t *vl,
static int wt_config_tsd(oconfig_item_t *ci)
{
struct wt_callback *cb;
static int wt_config_tsd(oconfig_item_t *ci)
{
struct wt_callback *cb;
- user_data_t user_data;
+ user_data_t user_data
= { 0 }
;
char callback_name[DATA_MAX_NAME_LEN];
int i;
char callback_name[DATA_MAX_NAME_LEN];
int i;
- cb =
malloc(
sizeof(*cb));
+ cb =
calloc(1,
sizeof(*cb));
if (cb == NULL)
{
if (cb == NULL)
{
- ERROR("write_tsdb plugin:
m
alloc failed.");
+ ERROR("write_tsdb plugin:
c
alloc failed.");
return -1;
}
return -1;
}
- memset(cb, 0, sizeof(*cb));
cb->sock_fd = -1;
cb->node = NULL;
cb->service = NULL;
cb->sock_fd = -1;
cb->node = NULL;
cb->service = NULL;
@@
-619,7
+616,6
@@
static int wt_config_tsd(oconfig_item_t *ci)
cb->node != NULL ? cb->node : WT_DEFAULT_NODE,
cb->service != NULL ? cb->service : WT_DEFAULT_SERVICE);
cb->node != NULL ? cb->node : WT_DEFAULT_NODE,
cb->service != NULL ? cb->service : WT_DEFAULT_SERVICE);
- memset(&user_data, 0, sizeof(user_data));
user_data.data = cb;
user_data.free_func = wt_callback_free;
plugin_register_write(callback_name, wt_write, &user_data);
user_data.data = cb;
user_data.free_func = wt_callback_free;
plugin_register_write(callback_name, wt_write, &user_data);