From: Ruben Kerkhof Date: Sat, 13 Aug 2016 13:55:39 +0000 (+0200) Subject: treewide: use designated initializers for user_data X-Git-Tag: collectd-5.6.0~46 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=361f0013d5a20fa0b229376ddc3804c6e00058c5;p=collectd.git treewide: use designated initializers for user_data --- diff --git a/src/curl_json.c b/src/curl_json.c index 0c10899a..ab0237e1 100644 --- a/src/curl_json.c +++ b/src/curl_json.c @@ -758,7 +758,6 @@ static int cj_config_add_url (oconfig_item_t *ci) /* {{{ */ /* If all went well, register this database for reading */ if (status == 0) { - user_data_t ud = { 0 }; char *cb_name; if (db->instance == NULL) @@ -767,12 +766,14 @@ static int cj_config_add_url (oconfig_item_t *ci) /* {{{ */ 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 1d9ecc0b..c8a1313c 100644 --- a/src/curl_xml.c +++ b/src/curl_xml.c @@ -1016,7 +1016,6 @@ static int cx_config_add_url (oconfig_item_t *ci) /* {{{ */ /* If all went well, register this database for reading */ if (status == 0) { - user_data_t ud = { 0 }; char *cb_name; if (db->instance == NULL) @@ -1025,10 +1024,13 @@ static int cx_config_add_url (oconfig_item_t *ci) /* {{{ */ 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 783ea2b9..068bf4d2 100644 --- a/src/dbi.c +++ b/src/dbi.c @@ -390,17 +390,18 @@ static int cdbi_config_add_database (oconfig_item_t *ci) /* {{{ */ } 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 47f4cd36..67740ac8 100644 --- a/src/java.c +++ b/src/java.c @@ -1417,7 +1417,6 @@ static jint JNICALL cjni_api_register_init (JNIEnv *jvm_env, /* {{{ */ 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); @@ -1426,8 +1425,10 @@ static jint JNICALL cjni_api_register_read (JNIEnv *jvm_env, /* {{{ */ 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); @@ -1440,7 +1441,6 @@ static jint JNICALL cjni_api_register_read (JNIEnv *jvm_env, /* {{{ */ 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); @@ -1449,8 +1449,10 @@ static jint JNICALL cjni_api_register_write (JNIEnv *jvm_env, /* {{{ */ 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); @@ -1462,7 +1464,6 @@ static jint JNICALL cjni_api_register_write (JNIEnv *jvm_env, /* {{{ */ 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); @@ -1471,8 +1472,10 @@ static jint JNICALL cjni_api_register_flush (JNIEnv *jvm_env, /* {{{ */ 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); @@ -1491,7 +1494,6 @@ static jint JNICALL cjni_api_register_shutdown (JNIEnv *jvm_env, /* {{{ */ 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); @@ -1500,8 +1502,10 @@ static jint JNICALL cjni_api_register_log (JNIEnv *jvm_env, /* {{{ */ 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); @@ -1513,7 +1517,6 @@ static jint JNICALL cjni_api_register_log (JNIEnv *jvm_env, /* {{{ */ 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 c5523606..9e6e7252 100644 --- a/src/memcached.c +++ b/src/memcached.c @@ -548,16 +548,17 @@ static int memcached_read (user_data_t *user_data) 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 a7a0b86d..ad889953 100644 --- a/src/mqtt.c +++ b/src/mqtt.c @@ -548,7 +548,6 @@ static int mqtt_config_publisher (oconfig_item_t *ci) { mqtt_client_conf_t *conf; char cb_name[1024]; - user_data_t user_data = { 0 }; int status; conf = calloc (1, sizeof (*conf)); @@ -632,7 +631,9 @@ static int mqtt_config_publisher (oconfig_item_t *ci) } 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 eea3df8d..32b72e28 100644 --- a/src/mysql.c +++ b/src/mysql.c @@ -222,21 +222,22 @@ static int mysql_config_database (oconfig_item_t *ci) /* {{{ */ /* 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 : ""); - 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 26577dad..d7396964 100644 --- a/src/netapp.c +++ b/src/netapp.c @@ -2872,7 +2872,6 @@ static int cna_read (user_data_t *ud); 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", @@ -2880,8 +2879,10 @@ static int cna_register_host (host_config_t *host) /* {{{ */ 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 a1fa5093..d424cb45 100644 --- a/src/openldap.c +++ b/src/openldap.c @@ -652,20 +652,21 @@ static int cldap_config_add (oconfig_item_t *ci) /* {{{ */ } 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 c4e19db6..084eae45 100644 --- a/src/postgresql.c +++ b/src/postgresql.c @@ -1176,8 +1176,6 @@ static int c_psql_config_database (oconfig_item_t *ci) 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) @@ -1260,11 +1258,13 @@ static int c_psql_config_database (oconfig_item_t *ci) } } - 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 24046de4..884bb054 100644 --- 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 e0e19732..abeda436 100644 --- a/src/snmp.c +++ b/src/snmp.c @@ -634,7 +634,6 @@ static int csnmp_config_add_host (oconfig_item_t *ci) /* Registration stuff. */ char cb_name[DATA_MAX_NAME_LEN]; - user_data_t cb_data = { 0 }; hd = calloc (1, sizeof (*hd)); if (hd == NULL) @@ -765,11 +764,13 @@ static int csnmp_config_add_host (oconfig_item_t *ci) 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 b8922ecb..e8cde1ed 100644 --- a/src/tail.c +++ b/src/tail.c @@ -328,7 +328,6 @@ static int ctail_read (user_data_t *ud) static int ctail_init (void) { char str[255]; - user_data_t ud = { 0 }; if (tail_match_list_num == 0) { @@ -338,8 +337,12 @@ static int ctail_init (void) 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 79ea4665..1bdf8b29 100644 --- a/src/tail_csv.c +++ b/src/tail_csv.c @@ -421,7 +421,6 @@ static int tcsv_config_add_file(oconfig_item_t *ci) /* Registration variables */ char cb_name[DATA_MAX_NAME_LEN]; - user_data_t cb_data = { 0 }; id = calloc(1, sizeof(*id)); if (id == NULL) @@ -482,9 +481,13 @@ static int tcsv_config_add_file(oconfig_item_t *ci) } 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 e65b2a37..6cc092c0 100644 --- a/src/varnish.c +++ b/src/varnish.c @@ -938,7 +938,6 @@ static int varnish_config_apply_default (user_config_t *conf) /* {{{ */ static int varnish_init (void) /* {{{ */ { user_config_t *conf; - user_data_t ud; if (have_instance) return (0); @@ -952,8 +951,10 @@ static int varnish_init (void) /* {{{ */ 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 8f38e061..fe2376ad 100644 --- a/src/write_graphite.c +++ b/src/write_graphite.c @@ -474,7 +474,6 @@ static int config_set_char (char *dest, 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; @@ -576,12 +575,15 @@ static int wg_config_node (oconfig_item_t *ci) 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 d8d8c34e..95132cf9 100644 --- a/src/write_http.c +++ b/src/write_http.c @@ -649,7 +649,6 @@ static int wh_config_node (oconfig_item_t *ci) /* {{{ */ { wh_callback_t *cb; int buffer_size = 0; - user_data_t user_data = { 0 }; char callback_name[DATA_MAX_NAME_LEN]; int status = 0; @@ -813,7 +812,10 @@ static int wh_config_node (oconfig_item_t *ci) /* {{{ */ 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 81ca128f..9fda2dfc 100644 --- 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 01ce64ac..6d5f3794 100644 --- a/src/write_mongodb.c +++ b/src/write_mongodb.c @@ -336,12 +336,13 @@ static int wm_config_node (oconfig_item_t *ci) /* {{{ */ 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 973b1801..47224162 100644 --- a/src/write_redis.c +++ b/src/write_redis.c @@ -231,12 +231,13 @@ static int wr_config_node (oconfig_item_t *ci) /* {{{ */ 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 0ed02603..043a06b0 100644 --- a/src/write_riemann.c +++ b/src/write_riemann.c @@ -611,7 +611,6 @@ static int wrr_config_node(oconfig_item_t *ci) /* {{{ */ 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."); @@ -789,8 +788,11 @@ static int wrr_config_node(oconfig_item_t *ci) /* {{{ */ 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 2f1f35aa..d764d260 100644 --- a/src/write_sensu.c +++ b/src/write_sensu.c @@ -978,7 +978,6 @@ static int sensu_config_node(oconfig_item_t *ci) /* {{{ */ 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."); @@ -1108,8 +1107,11 @@ static int sensu_config_node(oconfig_item_t *ci) /* {{{ */ } 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 c183d278..b670f3ae 100644 --- a/src/write_tsdb.c +++ b/src/write_tsdb.c @@ -570,7 +570,6 @@ 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; - user_data_t user_data = { 0 }; char callback_name[DATA_MAX_NAME_LEN]; cb = calloc(1, sizeof(*cb)); @@ -612,8 +611,11 @@ 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); - 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;