X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fjava.c;h=cd173c5890ae122dbe6db94dda4dead5699a1152;hb=5cd5988ec752f441254fc887117c3d5aa8f8d094;hp=47f4cd36cf0e396c81f6eef3125a23679b7f808a;hpb=7adc8768ee5f7276d1964da6d268effba557d3a5;p=collectd.git diff --git a/src/java.c b/src/java.c index 47f4cd36..cd173c58 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,11 +1425,11 @@ 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; - plugin_register_complex_read (/* group = */ NULL, cbi->name, cjni_read, - /* interval = */ 0, &ud); + /* interval = */ 0, &(user_data_t) { + .data = cbi, + .free_func = cjni_callback_info_destroy, + }); (*jvm_env)->DeleteLocalRef (jvm_env, o_read); @@ -1440,7 +1439,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,10 +1447,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; - - plugin_register_write (cbi->name, cjni_write, &ud); + plugin_register_write (cbi->name, cjni_write, &(user_data_t) { + .data = cbi, + .free_func = cjni_callback_info_destroy, + }); (*jvm_env)->DeleteLocalRef (jvm_env, o_write); @@ -1462,7 +1460,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,10 +1468,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; - - plugin_register_flush (cbi->name, cjni_flush, &ud); + plugin_register_flush (cbi->name, cjni_flush, &(user_data_t) { + .data = cbi, + .free_func = cjni_callback_info_destroy, + }); (*jvm_env)->DeleteLocalRef (jvm_env, o_flush); @@ -1491,7 +1488,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,10 +1496,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; - - plugin_register_log (cbi->name, cjni_log, &ud); + plugin_register_log (cbi->name, cjni_log, &(user_data_t) { + .data = cbi, + .free_func = cjni_callback_info_destroy, + }); (*jvm_env)->DeleteLocalRef (jvm_env, o_log); @@ -1513,7 +1509,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,10 +1518,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; - - plugin_register_notification (cbi->name, cjni_notification, &ud); + plugin_register_notification (cbi->name, cjni_notification, &(user_data_t) { + .data = cbi, + .free_func = cjni_callback_info_destroy, + }); (*jvm_env)->DeleteLocalRef (jvm_env, o_notification);