projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
collectctl: define LOCALSTATEDIR if not defined
[collectd.git]
/
src
/
java.c
diff --git
a/src/java.c
b/src/java.c
index
5e46f57
..
67740ac
100644
(file)
--- a/
src/java.c
+++ b/
src/java.c
@@
-507,7
+507,6
@@
static jobject ctoj_oconfig_item (JNIEnv *jvm_env, /* {{{ */
jmethodID m_addchild;
jobject o_key;
jobject o_ocitem;
jmethodID m_addchild;
jobject o_key;
jobject o_ocitem;
- int i;
c_ocitem = (*jvm_env)->FindClass (jvm_env, "org/collectd/api/OConfigItem");
if (c_ocitem == NULL)
c_ocitem = (*jvm_env)->FindClass (jvm_env, "org/collectd/api/OConfigItem");
if (c_ocitem == NULL)
@@
-572,7
+571,7
@@
static jobject ctoj_oconfig_item (JNIEnv *jvm_env, /* {{{ */
(*jvm_env)->DeleteLocalRef (jvm_env, o_key);
/* Call OConfigItem.addValue for each value */
(*jvm_env)->DeleteLocalRef (jvm_env, o_key);
/* Call OConfigItem.addValue for each value */
- for (i = 0; i < ci->values_num; i++) /* {{{ */
+ for (i
nt i
= 0; i < ci->values_num; i++) /* {{{ */
{
jobject o_value;
{
jobject o_value;
@@
-590,7
+589,7
@@
static jobject ctoj_oconfig_item (JNIEnv *jvm_env, /* {{{ */
} /* }}} for (i = 0; i < ci->values_num; i++) */
/* Call OConfigItem.addChild for each child */
} /* }}} for (i = 0; i < ci->values_num; i++) */
/* Call OConfigItem.addChild for each child */
- for (i = 0; i < ci->children_num; i++) /* {{{ */
+ for (i
nt i
= 0; i < ci->children_num; i++) /* {{{ */
{
jobject o_child;
{
jobject o_child;
@@
-618,7
+617,6
@@
static jobject ctoj_data_set (JNIEnv *jvm_env, const data_set_t *ds) /* {{{ */
jmethodID m_add;
jobject o_type;
jobject o_dataset;
jmethodID m_add;
jobject o_type;
jobject o_dataset;
- size_t i;
/* Look up the org/collectd/api/DataSet class */
c_dataset = (*jvm_env)->FindClass (jvm_env, "org/collectd/api/DataSet");
/* Look up the org/collectd/api/DataSet class */
c_dataset = (*jvm_env)->FindClass (jvm_env, "org/collectd/api/DataSet");
@@
-668,7
+666,7
@@
static jobject ctoj_data_set (JNIEnv *jvm_env, const data_set_t *ds) /* {{{ */
/* Decrease reference counter on the java.lang.String object. */
(*jvm_env)->DeleteLocalRef (jvm_env, o_type);
/* Decrease reference counter on the java.lang.String object. */
(*jvm_env)->DeleteLocalRef (jvm_env, o_type);
- for (i = 0; i < ds->ds_num; i++)
+ for (
size_t
i = 0; i < ds->ds_num; i++)
{
jobject o_datasource;
{
jobject o_datasource;
@@
-763,7
+761,6
@@
static jobject ctoj_value_list (JNIEnv *jvm_env, /* {{{ */
jmethodID m_valuelist_constructor;
jobject o_valuelist;
int status;
jmethodID m_valuelist_constructor;
jobject o_valuelist;
int status;
- size_t i;
/* First, create a new ValueList instance..
* Look up the class.. */
/* First, create a new ValueList instance..
* Look up the class.. */
@@
-846,7
+843,7
@@
static jobject ctoj_value_list (JNIEnv *jvm_env, /* {{{ */
return (NULL);
}
return (NULL);
}
- for (i = 0; i < vl->values_len; i++)
+ for (
size_t
i = 0; i < vl->values_len; i++)
{
status = ctoj_value_list_add_value (jvm_env, vl->values[i], ds->ds[i].type,
c_valuelist, o_valuelist);
{
status = ctoj_value_list_add_value (jvm_env, vl->values[i], ds->ds[i].type,
c_valuelist, o_valuelist);
@@
-1117,7
+1114,6
@@
static int jtoc_values_array (JNIEnv *jvm_env, /* {{{ */
value_t *values;
int values_num;
value_t *values;
int values_num;
- int i;
values_num = ds->ds_num;
values_num = ds->ds_num;
@@
-1177,7
+1173,7
@@
static int jtoc_values_array (JNIEnv *jvm_env, /* {{{ */
BAIL_OUT (-1);
}
BAIL_OUT (-1);
}
- for (i = 0; i < values_num; i++)
+ for (i
nt i
= 0; i < values_num; i++)
{
jobject o_number;
int status;
{
jobject o_number;
int status;
@@
-1421,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)
{
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);
cjni_callback_info_t *cbi;
cbi = cjni_callback_info_create (jvm_env, o_name, o_read, CB_TYPE_READ);
@@
-1430,8
+1425,10
@@
static jint JNICALL cjni_api_register_read (JNIEnv *jvm_env, /* {{{ */
DEBUG ("java plugin: Registering new read callback: %s", cbi->name);
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);
plugin_register_complex_read (/* group = */ NULL, cbi->name, cjni_read,
/* interval = */ 0, &ud);
@@
-1444,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)
{
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);
cjni_callback_info_t *cbi;
cbi = cjni_callback_info_create (jvm_env, o_name, o_write, CB_TYPE_WRITE);
@@
-1453,8
+1449,10
@@
static jint JNICALL cjni_api_register_write (JNIEnv *jvm_env, /* {{{ */
DEBUG ("java plugin: Registering new write callback: %s", cbi->name);
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);
plugin_register_write (cbi->name, cjni_write, &ud);
@@
-1466,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)
{
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);
cjni_callback_info_t *cbi;
cbi = cjni_callback_info_create (jvm_env, o_name, o_flush, CB_TYPE_FLUSH);
@@
-1475,8
+1472,10
@@
static jint JNICALL cjni_api_register_flush (JNIEnv *jvm_env, /* {{{ */
DEBUG ("java plugin: Registering new flush callback: %s", cbi->name);
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);
plugin_register_flush (cbi->name, cjni_flush, &ud);
@@
-1495,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)
{
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);
cjni_callback_info_t *cbi;
cbi = cjni_callback_info_create (jvm_env, o_name, o_log, CB_TYPE_LOG);
@@
-1504,8
+1502,10
@@
static jint JNICALL cjni_api_register_log (JNIEnv *jvm_env, /* {{{ */
DEBUG ("java plugin: Registering new log callback: %s", cbi->name);
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);
plugin_register_log (cbi->name, cjni_log, &ud);
@@
-1517,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)
{
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,
cjni_callback_info_t *cbi;
cbi = cjni_callback_info_create (jvm_env, o_name, o_notification,
@@
-1527,8
+1526,10
@@
static jint JNICALL cjni_api_register_notification (JNIEnv *jvm_env, /* {{{ */
DEBUG ("java plugin: Registering new notification callback: %s", cbi->name);
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);
plugin_register_notification (cbi->name, cjni_notification, &ud);
@@
-1980,7
+1981,6
@@
static int cjni_create_jvm (void) /* {{{ */
JavaVMOption vm_options[jvm_argc];
int status;
JavaVMOption vm_options[jvm_argc];
int status;
- size_t i;
if (jvm != NULL)
return (0);
if (jvm != NULL)
return (0);
@@
-1999,7
+1999,7
@@
static int cjni_create_jvm (void) /* {{{ */
vm_args.options = vm_options;
vm_args.nOptions = (jint) jvm_argc;
vm_args.options = vm_options;
vm_args.nOptions = (jint) jvm_argc;
- for (i = 0; i < jvm_argc; i++)
+ for (
size_t
i = 0; i < jvm_argc; i++)
{
DEBUG ("java plugin: cjni_create_jvm: jvm_argv[%zu] = %s",
i, jvm_argv[i]);
{
DEBUG ("java plugin: cjni_create_jvm: jvm_argv[%zu] = %s",
i, jvm_argv[i]);
@@
-2216,8
+2216,7
@@
static int cjni_config_load_plugin (oconfig_item_t *ci) /* {{{ */
{ /* Replace all dots ('.') with slashes ('/'). Dots are usually used
thorough the Java community, but (Sun's) `FindClass' and friends need
slashes. */
{ /* Replace all dots ('.') with slashes ('/'). Dots are usually used
thorough the Java community, but (Sun's) `FindClass' and friends need
slashes. */
- size_t i;
- for (i = 0; class->name[i] != 0; i++)
+ for (size_t i = 0; class->name[i] != 0; i++)
if (class->name[i] == '.')
class->name[i] = '/';
}
if (class->name[i] == '.')
class->name[i] = '/';
}
@@
-2275,7
+2274,6
@@
static int cjni_config_plugin_block (oconfig_item_t *ci) /* {{{ */
cjni_callback_info_t *cbi;
jobject o_ocitem;
const char *name;
cjni_callback_info_t *cbi;
jobject o_ocitem;
const char *name;
- size_t i;
jclass class;
jmethodID method;
jclass class;
jmethodID method;
@@
-2290,7
+2288,7
@@
static int cjni_config_plugin_block (oconfig_item_t *ci) /* {{{ */
name = ci->values[0].value.string;
cbi = NULL;
name = ci->values[0].value.string;
cbi = NULL;
- for (i = 0; i < java_callbacks_num; i++)
+ for (
size_t
i = 0; i < java_callbacks_num; i++)
{
if (java_callbacks[i].type != CB_TYPE_CONFIG)
continue;
{
if (java_callbacks[i].type != CB_TYPE_CONFIG)
continue;
@@
-2342,12
+2340,11
@@
static int cjni_config_perform (oconfig_item_t *ci) /* {{{ */
int success;
int errors;
int status;
int success;
int errors;
int status;
- int i;
success = 0;
errors = 0;
success = 0;
errors = 0;
- for (i = 0; i < ci->children_num; i++)
+ for (i
nt i
= 0; i < ci->children_num; i++)
{
oconfig_item_t *child = ci->children + i;
{
oconfig_item_t *child = ci->children + i;
@@
-2710,7
+2707,6
@@
static int cjni_match_target_create (const oconfig_item_t *ci, /* {{{ */
jobject o_ci;
jobject o_tmp;
int type;
jobject o_ci;
jobject o_tmp;
int type;
- size_t i;
cbi_ret = NULL;
o_ci = NULL;
cbi_ret = NULL;
o_ci = NULL;
@@
-2755,7
+2751,7
@@
static int cjni_match_target_create (const oconfig_item_t *ci, /* {{{ */
/* Lets see if we have a matching factory here.. */
cbi_factory = NULL;
/* Lets see if we have a matching factory here.. */
cbi_factory = NULL;
- for (i = 0; i < java_callbacks_num; i++)
+ for (
size_t
i = 0; i < java_callbacks_num; i++)
{
if (java_callbacks[i].type != type)
continue;
{
if (java_callbacks[i].type != type)
continue;
@@
-2937,9
+2933,8
@@
static int cjni_match_target_invoke (const data_set_t *ds, /* {{{ */
static int cjni_init_plugins (JNIEnv *jvm_env) /* {{{ */
{
int status;
static int cjni_init_plugins (JNIEnv *jvm_env) /* {{{ */
{
int status;
- size_t i;
- for (i = 0; i < java_callbacks_num; i++)
+ for (
size_t
i = 0; i < java_callbacks_num; i++)
{
if (java_callbacks[i].type != CB_TYPE_INIT)
continue;
{
if (java_callbacks[i].type != CB_TYPE_INIT)
continue;
@@
-2964,9
+2959,8
@@
static int cjni_init_plugins (JNIEnv *jvm_env) /* {{{ */
static int cjni_shutdown_plugins (JNIEnv *jvm_env) /* {{{ */
{
int status;
static int cjni_shutdown_plugins (JNIEnv *jvm_env) /* {{{ */
{
int status;
- size_t i;
- for (i = 0; i < java_callbacks_num; i++)
+ for (
size_t
i = 0; i < java_callbacks_num; i++)
{
if (java_callbacks[i].type != CB_TYPE_SHUTDOWN)
continue;
{
if (java_callbacks[i].type != CB_TYPE_SHUTDOWN)
continue;
@@
-2991,7
+2985,6
@@
static int cjni_shutdown (void) /* {{{ */
JNIEnv *jvm_env;
JavaVMAttachArgs args = { 0 };
int status;
JNIEnv *jvm_env;
JavaVMAttachArgs args = { 0 };
int status;
- size_t i;
if (jvm == NULL)
return (0);
if (jvm == NULL)
return (0);
@@
-3011,7
+3004,7
@@
static int cjni_shutdown (void) /* {{{ */
cjni_shutdown_plugins (jvm_env);
/* Release all the global references to callback functions */
cjni_shutdown_plugins (jvm_env);
/* Release all the global references to callback functions */
- for (i = 0; i < java_callbacks_num; i++)
+ for (
size_t
i = 0; i < java_callbacks_num; i++)
{
if (java_callbacks[i].object != NULL)
{
{
if (java_callbacks[i].object != NULL)
{
@@
-3024,7
+3017,7
@@
static int cjni_shutdown (void) /* {{{ */
sfree (java_callbacks);
/* Release all the global references to directly loaded classes. */
sfree (java_callbacks);
/* Release all the global references to directly loaded classes. */
- for (i = 0; i < java_classes_list_len; i++)
+ for (
size_t
i = 0; i < java_classes_list_len; i++)
{
if (java_classes_list[i].object != NULL)
{
{
if (java_classes_list[i].object != NULL)
{
@@
-3045,7
+3038,7
@@
static int cjni_shutdown (void) /* {{{ */
pthread_key_delete (jvm_env_key);
/* Free the JVM argument list */
pthread_key_delete (jvm_env_key);
/* Free the JVM argument list */
- for (i = 0; i < jvm_argc; i++)
+ for (
size_t
i = 0; i < jvm_argc; i++)
sfree (jvm_argv[i]);
jvm_argc = 0;
sfree (jvm_argv);
sfree (jvm_argv[i]);
jvm_argc = 0;
sfree (jvm_argv);