X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fwrite_tsdb.c;h=2bd27072398541c124016f1c6e97fc8c26936726;hb=f3d13bd9c187c75ec9b4dbf42f8d821fb303bc90;hp=2ed43890936d3699ba882c2b3d46c9dce33aacd7;hpb=ca4a6c8a856a9012270ec10389b08d54e70e3401;p=collectd.git diff --git a/src/write_tsdb.c b/src/write_tsdb.c index 2ed43890..2bd27072 100644 --- a/src/write_tsdb.c +++ b/src/write_tsdb.c @@ -48,7 +48,6 @@ #include "utils_cache.h" -#include #include #ifndef WT_DEFAULT_NODE @@ -142,7 +141,7 @@ static int wt_flush_nolock(cdtime_t timeout, struct wt_callback *cb) return 0; } - if (cb->send_buf_fill <= 0) + if (cb->send_buf_fill == 0) { cb->send_buf_init_time = cdtime(); return 0; @@ -346,7 +345,7 @@ static int wt_format_name(char *ret, int ret_len, { int status; char *temp = NULL; - char *prefix = ""; + const char *prefix = ""; const char *meta_prefix = "tsdb_prefix"; if (vl->meta) { @@ -411,9 +410,9 @@ static int wt_send_message (const char* key, const char* value, int status; size_t message_len; char *temp = NULL; - char *tags = ""; + const char *tags = ""; char message[1024]; - char *host_tags = cb->host_tags ? cb->host_tags : ""; + const char *host_tags = cb->host_tags ? cb->host_tags : ""; const char *meta_tsdb = "tsdb_tags"; /* skip if value is NaN */ @@ -579,13 +578,12 @@ static int wt_config_tsd(oconfig_item_t *ci) char callback_name[DATA_MAX_NAME_LEN]; int i; - cb = malloc(sizeof(*cb)); + cb = calloc(1, sizeof(*cb)); if (cb == NULL) { - ERROR("write_tsdb plugin: malloc failed."); + ERROR("write_tsdb plugin: calloc failed."); return -1; } - memset(cb, 0, sizeof(*cb)); cb->sock_fd = -1; cb->node = NULL; cb->service = NULL;