summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c3cc7a2)
raw | patch | inline | side by side (parent: c3cc7a2)
author | Ruben Kerkhof <ruben@rubenkerkhof.com> | |
Sat, 13 Aug 2016 13:55:39 +0000 (15:55 +0200) | ||
committer | Ruben Kerkhof <ruben@rubenkerkhof.com> | |
Sat, 13 Aug 2016 13:55:39 +0000 (15:55 +0200) |
23 files changed:
src/curl_json.c | patch | blob | history | |
src/curl_xml.c | patch | blob | history | |
src/dbi.c | patch | blob | history | |
src/java.c | patch | blob | history | |
src/memcached.c | patch | blob | history | |
src/mqtt.c | patch | blob | history | |
src/mysql.c | patch | blob | history | |
src/netapp.c | patch | blob | history | |
src/openldap.c | patch | blob | history | |
src/postgresql.c | patch | blob | history | |
src/python.c | patch | blob | history | |
src/snmp.c | patch | blob | history | |
src/tail.c | patch | blob | history | |
src/tail_csv.c | patch | blob | history | |
src/varnish.c | patch | blob | history | |
src/write_graphite.c | patch | blob | history | |
src/write_http.c | patch | blob | history | |
src/write_kafka.c | patch | blob | history | |
src/write_mongodb.c | patch | blob | history | |
src/write_redis.c | patch | blob | history | |
src/write_riemann.c | patch | blob | history | |
src/write_sensu.c | patch | blob | history | |
src/write_tsdb.c | patch | blob | history |
diff --git a/src/curl_json.c b/src/curl_json.c
index 0c10899ae0a1e46995227a6006de73d5654b8a8e..ab0237e14df982a1f621e286014cacb70b14d340 100644 (file)
--- a/src/curl_json.c
+++ b/src/curl_json.c
/* If all went well, register this database for reading */
if (status == 0)
{
- user_data_t ud = { 0 };
char *cb_name;
if (db->instance == NULL)
DEBUG ("curl_json plugin: Registering new read callback: %s",
db->instance);
- ud.data = (void *) db;
- ud.free_func = cj_free;
-
cb_name = ssnprintf_alloc ("curl_json-%s-%s",
db->instance, db->url ? db->url : db->sock);
+ user_data_t ud = {
+ .data = db,
+ .free_func = cj_free
+ };
+
plugin_register_complex_read (/* group = */ NULL, cb_name, cj_read,
/* interval = */ db->interval,
&ud);
diff --git a/src/curl_xml.c b/src/curl_xml.c
index 1d9ecc0bfa50f358fa828cfa914d412f6975c40b..c8a1313cbec48769c882ab5cb034faae3da1cc07 100644 (file)
--- a/src/curl_xml.c
+++ b/src/curl_xml.c
/* If all went well, register this database for reading */
if (status == 0)
{
- user_data_t ud = { 0 };
char *cb_name;
if (db->instance == NULL)
DEBUG ("curl_xml plugin: Registering new read callback: %s",
db->instance);
- ud.data = (void *) db;
- ud.free_func = cx_free;
-
cb_name = ssnprintf_alloc ("curl_xml-%s-%s", db->instance, db->url);
+
+ user_data_t ud = {
+ .data = db,
+ .free_func = cx_free
+ };
+
plugin_register_complex_read (/* group = */ "curl_xml", cb_name, cx_read,
/* interval = */ 0, &ud);
sfree (cb_name);
diff --git a/src/dbi.c b/src/dbi.c
index 783ea2b9e5b88a4b693b357738486b215770b7bc..068bf4d2f014c0643c02240dcebe4abdd3336b34 100644 (file)
--- a/src/dbi.c
+++ b/src/dbi.c
}
else
{
- user_data_t ud = { 0 };
char *name = NULL;
databases = temp;
databases[databases_num] = db;
databases_num++;
- ud.data = (void *) db;
- ud.free_func = NULL;
name = ssnprintf_alloc("dbi:%s", db->name);
+ user_data_t ud = {
+ .data = db
+ };
+
plugin_register_complex_read (/* group = */ NULL,
/* name = */ name ? name : db->name,
/* callback = */ cdbi_read_database,
diff --git a/src/java.c b/src/java.c
index 47f4cd36cf0e396c81f6eef3125a23679b7f808a..67740ac8dae78c6da33a4d47891c9824fa04096a 100644 (file)
--- a/src/java.c
+++ b/src/java.c
static jint JNICALL cjni_api_register_read (JNIEnv *jvm_env, /* {{{ */
jobject this, jobject o_name, jobject o_read)
{
- user_data_t ud = { 0 };
cjni_callback_info_t *cbi;
cbi = cjni_callback_info_create (jvm_env, o_name, o_read, CB_TYPE_READ);
DEBUG ("java plugin: Registering new read callback: %s", cbi->name);
- ud.data = (void *) cbi;
- ud.free_func = cjni_callback_info_destroy;
+ user_data_t ud = {
+ .data = cbi,
+ .free_func = cjni_callback_info_destroy
+ };
plugin_register_complex_read (/* group = */ NULL, cbi->name, cjni_read,
/* interval = */ 0, &ud);
static jint JNICALL cjni_api_register_write (JNIEnv *jvm_env, /* {{{ */
jobject this, jobject o_name, jobject o_write)
{
- user_data_t ud = { 0 };
cjni_callback_info_t *cbi;
cbi = cjni_callback_info_create (jvm_env, o_name, o_write, CB_TYPE_WRITE);
DEBUG ("java plugin: Registering new write callback: %s", cbi->name);
- ud.data = (void *) cbi;
- ud.free_func = cjni_callback_info_destroy;
+ user_data_t ud = {
+ .data = cbi,
+ .free_func = cjni_callback_info_destroy
+ };
plugin_register_write (cbi->name, cjni_write, &ud);
static jint JNICALL cjni_api_register_flush (JNIEnv *jvm_env, /* {{{ */
jobject this, jobject o_name, jobject o_flush)
{
- user_data_t ud = { 0 };
cjni_callback_info_t *cbi;
cbi = cjni_callback_info_create (jvm_env, o_name, o_flush, CB_TYPE_FLUSH);
DEBUG ("java plugin: Registering new flush callback: %s", cbi->name);
- ud.data = (void *) cbi;
- ud.free_func = cjni_callback_info_destroy;
+ user_data_t ud = {
+ .data = cbi,
+ .free_func = cjni_callback_info_destroy
+ };
plugin_register_flush (cbi->name, cjni_flush, &ud);
static jint JNICALL cjni_api_register_log (JNIEnv *jvm_env, /* {{{ */
jobject this, jobject o_name, jobject o_log)
{
- user_data_t ud = { 0 };
cjni_callback_info_t *cbi;
cbi = cjni_callback_info_create (jvm_env, o_name, o_log, CB_TYPE_LOG);
DEBUG ("java plugin: Registering new log callback: %s", cbi->name);
- ud.data = (void *) cbi;
- ud.free_func = cjni_callback_info_destroy;
+ user_data_t ud = {
+ .data = cbi,
+ .free_func = cjni_callback_info_destroy
+ };
plugin_register_log (cbi->name, cjni_log, &ud);
static jint JNICALL cjni_api_register_notification (JNIEnv *jvm_env, /* {{{ */
jobject this, jobject o_name, jobject o_notification)
{
- user_data_t ud = { 0 };
cjni_callback_info_t *cbi;
cbi = cjni_callback_info_create (jvm_env, o_name, o_notification,
@@ -1523,8 +1526,10 @@ static jint JNICALL cjni_api_register_notification (JNIEnv *jvm_env, /* {{{ */
DEBUG ("java plugin: Registering new notification callback: %s", cbi->name);
- ud.data = (void *) cbi;
- ud.free_func = cjni_callback_info_destroy;
+ user_data_t ud = {
+ .data = cbi,
+ .free_func = cjni_callback_info_destroy
+ };
plugin_register_notification (cbi->name, cjni_notification, &ud);
diff --git a/src/memcached.c b/src/memcached.c
index c552360649a5e90253ca1709ff8d92eca1609223..9e6e725293d152561bd3287427f3e90dffb217f5 100644 (file)
--- a/src/memcached.c
+++ b/src/memcached.c
static int memcached_add_read_callback (memcached_t *st)
{
- user_data_t ud = { 0 };
char callback_name[3*DATA_MAX_NAME_LEN];
int status;
- ud.data = st;
- ud.free_func = memcached_free;
-
assert (st->name != NULL);
ssnprintf (callback_name, sizeof (callback_name), "memcached/%s", st->name);
+ user_data_t ud = {
+ .data = st,
+ .free_func = memcached_free
+ };
+
status = plugin_register_complex_read (/* group = */ "memcached",
/* name = */ callback_name,
/* callback = */ memcached_read,
diff --git a/src/mqtt.c b/src/mqtt.c
index a7a0b86d3c4c00c6386fcb27dcea476e564acc0f..ad889953a1127a561234af42463fc040cba2bf7c 100644 (file)
--- a/src/mqtt.c
+++ b/src/mqtt.c
{
mqtt_client_conf_t *conf;
char cb_name[1024];
- user_data_t user_data = { 0 };
int status;
conf = calloc (1, sizeof (*conf));
}
ssnprintf (cb_name, sizeof (cb_name), "mqtt/%s", conf->name);
- user_data.data = conf;
+ user_data_t user_data = {
+ .data = conf
+ };
plugin_register_write (cb_name, mqtt_write, &user_data);
return (0);
diff --git a/src/mysql.c b/src/mysql.c
index eea3df8df519c8480fb196b3762aada98f487f1d..32b72e286a0b0d08a4f8202ad17ac8296601504a 100644 (file)
--- a/src/mysql.c
+++ b/src/mysql.c
/* If all went well, register this database for reading */
if (status == 0)
{
- user_data_t ud = { 0 };
char cb_name[DATA_MAX_NAME_LEN];
DEBUG ("mysql plugin: Registering new read callback: %s",
(db->database != NULL) ? db->database : "<default>");
- ud.data = (void *) db;
- ud.free_func = mysql_database_free;
-
if (db->instance != NULL)
ssnprintf (cb_name, sizeof (cb_name), "mysql-%s",
db->instance);
else
sstrncpy (cb_name, "mysql", sizeof (cb_name));
+ user_data_t ud = {
+ .data = db,
+ .free_func = mysql_database_free
+ };
+
plugin_register_complex_read (/* group = */ NULL, cb_name,
mysql_read,
/* interval = */ 0, &ud);
diff --git a/src/netapp.c b/src/netapp.c
index 26577dadba5abfde0ec6ca06d95c3c9d836c3c5a..d73969646f7ca9be74c966fcd3da03d2754cc0a0 100644 (file)
--- a/src/netapp.c
+++ b/src/netapp.c
static int cna_register_host (host_config_t *host) /* {{{ */
{
char cb_name[256];
- user_data_t ud = { 0 };
if (host->vfiler)
ssnprintf (cb_name, sizeof (cb_name), "netapp-%s-%s",
else
ssnprintf (cb_name, sizeof (cb_name), "netapp-%s", host->name);
- ud.data = host;
- ud.free_func = (void (*) (void *)) free_host_config;
+ user_data_t ud = {
+ .data = host,
+ .free_func = (void (*) (void *)) free_host_config
+ };
plugin_register_complex_read (/* group = */ NULL, cb_name,
/* callback = */ cna_read,
diff --git a/src/openldap.c b/src/openldap.c
index a1fa509345b6657a6b7d6a3c46061fb915722c76..d424cb457557fe563ebc4cf997604d42a19ada53 100644 (file)
--- a/src/openldap.c
+++ b/src/openldap.c
}
else
{
- user_data_t ud = { 0 };
char callback_name[3*DATA_MAX_NAME_LEN] = { 0 };
databases = temp;
databases[databases_num] = st;
databases_num++;
- ud.data = st;
-
ssnprintf (callback_name, sizeof (callback_name),
"openldap/%s/%s",
(st->host != NULL) ? st->host : hostname_g,
(st->name != NULL) ? st->name : "default");
+ user_data_t ud = {
+ .data = st
+ };
+
status = plugin_register_complex_read (/* group = */ NULL,
/* name = */ callback_name,
/* callback = */ cldap_read_host,
diff --git a/src/postgresql.c b/src/postgresql.c
index c4e19db65919abe46da85dac99c47d8411af75f9..084eae453393a3bb86c0766966d2e45b5a514e5f 100644 (file)
--- a/src/postgresql.c
+++ b/src/postgresql.c
c_psql_database_t *db;
char cb_name[DATA_MAX_NAME_LEN];
- user_data_t ud = { 0 };
-
static _Bool have_flush = 0;
if ((1 != ci->values_num)
}
}
- ud.data = db;
- ud.free_func = c_psql_database_delete;
-
ssnprintf (cb_name, sizeof (cb_name), "postgresql-%s", db->instance);
+ user_data_t ud = {
+ .data = db,
+ .free_func = c_psql_database_delete
+ };
+
if (db->queries_num > 0) {
++db->ref_cnt;
plugin_register_complex_read ("postgresql", cb_name, c_psql_read,
diff --git a/src/python.c b/src/python.c
index 24046de4568723b979889d3f558d6cfe1325c959..884bb054ace00a0b6eed302457930cf6c52bb2d0 100644 (file)
--- a/src/python.c
+++ b/src/python.c
@@ -624,7 +624,6 @@ static PyObject *cpy_register_generic_userdata(void *reg, void *handler, PyObjec
char buf[512];
reg_function_t *register_function = (reg_function_t *) reg;
cpy_callback_t *c = NULL;
- user_data_t user_data = { 0 };
char *name = NULL;
PyObject *callback = NULL, *data = NULL;
static char *kwlist[] = {"callback", "data", "name", NULL};
@@ -650,8 +649,10 @@ static PyObject *cpy_register_generic_userdata(void *reg, void *handler, PyObjec
c->data = data;
c->next = NULL;
- user_data.free_func = cpy_destroy_user_data;
- user_data.data = c;
+ user_data_t user_data = {
+ .data = c,
+ .free_func = cpy_destroy_user_data
+ };
register_function(buf, handler, &user_data);
return cpy_string_to_unicode_or_bytes(buf);
@@ -660,7 +661,6 @@ static PyObject *cpy_register_generic_userdata(void *reg, void *handler, PyObjec
static PyObject *cpy_register_read(PyObject *self, PyObject *args, PyObject *kwds) {
char buf[512];
cpy_callback_t *c = NULL;
- user_data_t user_data = { 0 };
double interval = 0;
char *name = NULL;
PyObject *callback = NULL, *data = NULL;
@@ -687,8 +687,10 @@ static PyObject *cpy_register_read(PyObject *self, PyObject *args, PyObject *kwd
c->data = data;
c->next = NULL;
- user_data.free_func = cpy_destroy_user_data;
- user_data.data = c;
+ user_data_t user_data = {
+ .data = c,
+ .free_func = cpy_destroy_user_data
+ };
plugin_register_complex_read(/* group = */ "python", buf,
cpy_read_callback, DOUBLE_TO_CDTIME_T (interval), &user_data);
diff --git a/src/snmp.c b/src/snmp.c
index e0e19732be3a687ac7e3fd301996d7b9d54b84fc..abeda436795427f9597e281c30ce1e8ae656b519 100644 (file)
--- a/src/snmp.c
+++ b/src/snmp.c
/* Registration stuff. */
char cb_name[DATA_MAX_NAME_LEN];
- user_data_t cb_data = { 0 };
hd = calloc (1, sizeof (*hd));
if (hd == NULL)
ssnprintf (cb_name, sizeof (cb_name), "snmp-%s", hd->name);
- cb_data.data = hd;
- cb_data.free_func = csnmp_host_definition_destroy;
+ user_data_t ud = {
+ .data = hd,
+ .free_func = csnmp_host_definition_destroy
+ };
status = plugin_register_complex_read (/* group = */ NULL, cb_name,
- csnmp_read_host, hd->interval, /* user_data = */ &cb_data);
+ csnmp_read_host, hd->interval, /* user_data = */ &ud);
if (status != 0)
{
ERROR ("snmp plugin: Registering complex read function failed.");
diff --git a/src/tail.c b/src/tail.c
index b8922ecb388039098ebde1209cb69ed3ec464c13..e8cde1edcd21a3cf27a1e9a8dea4ba9f7588e728 100644 (file)
--- a/src/tail.c
+++ b/src/tail.c
static int ctail_init (void)
{
char str[255];
- user_data_t ud = { 0 };
if (tail_match_list_num == 0)
{
for (size_t i = 0; i < tail_match_list_num; i++)
{
- ud.data = (void *)tail_match_list[i];
ssnprintf(str, sizeof(str), "tail-%zu", i);
+
+ user_data_t ud = {
+ .data = tail_match_list[i]
+ };
+
plugin_register_complex_read (NULL, str, ctail_read, tail_match_list_intervals[i], &ud);
}
diff --git a/src/tail_csv.c b/src/tail_csv.c
index 79ea46654659ced9fab69bd8ae97e6111dc9c842..1bdf8b29de65dc4317b9714613ea337028d06408 100644 (file)
--- a/src/tail_csv.c
+++ b/src/tail_csv.c
/* Registration variables */
char cb_name[DATA_MAX_NAME_LEN];
- user_data_t cb_data = { 0 };
id = calloc(1, sizeof(*id));
if (id == NULL)
}
ssnprintf (cb_name, sizeof (cb_name), "tail_csv/%s", id->path);
- cb_data.data = id;
- cb_data.free_func = tcsv_instance_definition_destroy;
- status = plugin_register_complex_read(NULL, cb_name, tcsv_read, id->interval, &cb_data);
+
+ user_data_t ud = {
+ .data = id,
+ .free_func = tcsv_instance_definition_destroy
+ };
+
+ status = plugin_register_complex_read(NULL, cb_name, tcsv_read, id->interval, &ud);
if (status != 0){
ERROR("tail_csv plugin: Registering complex read function failed.");
diff --git a/src/varnish.c b/src/varnish.c
index e65b2a37223ffea64a8ded1d33f6fab22361afb7..6cc092c0041eac9fcb028e179610f1c4cf40606e 100644 (file)
--- a/src/varnish.c
+++ b/src/varnish.c
static int varnish_init (void) /* {{{ */
{
user_config_t *conf;
- user_data_t ud;
if (have_instance)
return (0);
varnish_config_apply_default (conf);
- ud.data = conf;
- ud.free_func = varnish_config_free;
+ user_data_t ud = {
+ .data = conf,
+ .free_func = varnish_config_free
+ };
plugin_register_complex_read (/* group = */ "varnish",
/* name = */ "varnish/localhost",
diff --git a/src/write_graphite.c b/src/write_graphite.c
index 8f38e06141ca9c1391026b3452d9bd3b34c30efc..fe2376ad7382f0d2ae14f39ef6500c26e49ec8df 100644 (file)
--- a/src/write_graphite.c
+++ b/src/write_graphite.c
static int wg_config_node (oconfig_item_t *ci)
{
struct wg_callback *cb;
- user_data_t user_data = { 0 };
char callback_name[DATA_MAX_NAME_LEN];
int status = 0;
ssnprintf (callback_name, sizeof (callback_name), "write_graphite/%s",
cb->name);
- user_data.data = cb;
- user_data.free_func = wg_callback_free;
- plugin_register_write (callback_name, wg_write, &user_data);
+ user_data_t ud = {
+ .data = cb,
+ .free_func = wg_callback_free
+ };
+
+ plugin_register_write (callback_name, wg_write, &ud);
- user_data.free_func = NULL;
- plugin_register_flush (callback_name, wg_flush, &user_data);
+ ud.free_func = NULL;
+ plugin_register_flush (callback_name, wg_flush, &ud);
return (0);
}
diff --git a/src/write_http.c b/src/write_http.c
index d8d8c34e60f9fd0e1f2dcdb709ea63d65e61766d..95132cf92f7bcd8d541bd53aa38a34b72de28c9a 100644 (file)
--- a/src/write_http.c
+++ b/src/write_http.c
{
wh_callback_t *cb;
int buffer_size = 0;
- user_data_t user_data = { 0 };
char callback_name[DATA_MAX_NAME_LEN];
int status = 0;
DEBUG ("write_http: Registering write callback '%s' with URL '%s'",
callback_name, cb->location);
- user_data.data = cb;
+ user_data_t user_data = {
+ .data = cb
+ };
+
plugin_register_flush (callback_name, wh_flush, &user_data);
user_data.free_func = wh_callback_free;
diff --git a/src/write_kafka.c b/src/write_kafka.c
index 81ca128f327a5b8fbb40700aefcf8a5d190fd215..9fda2dfc13a416989afeb1de71b2ad6dcb84a99d 100644 (file)
--- a/src/write_kafka.c
+++ b/src/write_kafka.c
@@ -245,7 +245,6 @@ static void kafka_config_topic(rd_kafka_conf_t *conf, oconfig_item_t *ci) /* {{{
char *val;
char callback_name[DATA_MAX_NAME_LEN];
char errbuf[1024];
- user_data_t ud;
oconfig_item_t *child;
rd_kafka_conf_res_t ret;
@@ -384,8 +383,10 @@ static void kafka_config_topic(rd_kafka_conf_t *conf, oconfig_item_t *ci) /* {{{
ssnprintf(callback_name, sizeof(callback_name),
"write_kafka/%s", tctx->topic_name);
- ud.data = tctx;
- ud.free_func = kafka_topic_context_free;
+ user_data_t ud = {
+ .data = tctx,
+ .free_func = kafka_topic_context_free
+ };
status = plugin_register_write (callback_name, kafka_write, &ud);
if (status != 0) {
diff --git a/src/write_mongodb.c b/src/write_mongodb.c
index 01ce64ac7d09157f43105d3b1054af2e7033dffb..6d5f37943ea330c369fc6f871777aa8f7887e6e3 100644 (file)
--- a/src/write_mongodb.c
+++ b/src/write_mongodb.c
if (status == 0)
{
char cb_name[DATA_MAX_NAME_LEN];
- user_data_t ud;
ssnprintf (cb_name, sizeof (cb_name), "write_mongodb/%s", node->name);
- ud.data = node;
- ud.free_func = wm_config_free;
+ user_data_t ud = {
+ .data = node,
+ .free_func = wm_config_free
+ };
status = plugin_register_write (cb_name, wm_write, &ud);
INFO ("write_mongodb plugin: registered write plugin %s %d",cb_name,status);
diff --git a/src/write_redis.c b/src/write_redis.c
index 973b1801b12018ee590b54a3cde1a546b0790a97..472241623dd51b02890c9f9324dae3a9a6ec9b56 100644 (file)
--- a/src/write_redis.c
+++ b/src/write_redis.c
if (status == 0)
{
char cb_name[DATA_MAX_NAME_LEN];
- user_data_t ud;
ssnprintf (cb_name, sizeof (cb_name), "write_redis/%s", node->name);
- ud.data = node;
- ud.free_func = wr_config_free;
+ user_data_t ud = {
+ .data = node,
+ .free_func = wr_config_free
+ };
status = plugin_register_write (cb_name, wr_write, &ud);
}
diff --git a/src/write_riemann.c b/src/write_riemann.c
index 0ed02603283036d0060b16c75849e87272372260..043a06b0a55e9b1dfdf01291f253fc02586ce322 100644 (file)
--- a/src/write_riemann.c
+++ b/src/write_riemann.c
int i;
oconfig_item_t *child;
char callback_name[DATA_MAX_NAME_LEN];
- user_data_t ud;
if ((host = calloc(1, sizeof(*host))) == NULL) {
ERROR("write_riemann plugin: calloc failed.");
ssnprintf(callback_name, sizeof(callback_name), "write_riemann/%s",
host->name);
- ud.data = host;
- ud.free_func = wrr_free;
+
+ user_data_t ud = {
+ .data = host,
+ .free_func = wrr_free
+ };
pthread_mutex_lock(&host->lock);
diff --git a/src/write_sensu.c b/src/write_sensu.c
index 2f1f35aa0e1f01879798a74ae1a3b1a38153ac36..d764d2605351cefd716547a055d09437cac39ccb 100644 (file)
--- a/src/write_sensu.c
+++ b/src/write_sensu.c
int status = 0;
oconfig_item_t *child;
char callback_name[DATA_MAX_NAME_LEN];
- user_data_t ud;
if ((host = calloc(1, sizeof(*host))) == NULL) {
ERROR("write_sensu plugin: calloc failed.");
}
ssnprintf(callback_name, sizeof(callback_name), "write_sensu/%s", host->name);
- ud.data = host;
- ud.free_func = sensu_free;
+
+ user_data_t ud = {
+ .data = host,
+ .free_func = sensu_free
+ };
pthread_mutex_lock(&host->lock);
diff --git a/src/write_tsdb.c b/src/write_tsdb.c
index c183d27847fac9885a4930a393f5415465a0b2a7..b670f3ae583d3d401565c019ed5df900667f87b8 100644 (file)
--- a/src/write_tsdb.c
+++ b/src/write_tsdb.c
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];
cb = calloc(1, sizeof(*cb));
cb->node != NULL ? cb->node : WT_DEFAULT_NODE,
cb->service != NULL ? cb->service : WT_DEFAULT_SERVICE);
- user_data.data = cb;
- user_data.free_func = wt_callback_free;
+ user_data_t user_data = {
+ .data = cb,
+ .free_func = wt_callback_free
+ };
+
plugin_register_write(callback_name, wt_write, &user_data);
user_data.free_func = NULL;