From cbf284725ad8abc7b3baa8aec1d51950f23561e3 Mon Sep 17 00:00:00 2001 From: Gabriel Corona Date: Tue, 8 Dec 2015 09:08:37 +0100 Subject: [PATCH] [java] Delcare some local variables where they are used --- src/bindings/java/jmsg.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/bindings/java/jmsg.cpp b/src/bindings/java/jmsg.cpp index f3cf6c49a0..4a7d546896 100644 --- a/src/bindings/java/jmsg.cpp +++ b/src/bindings/java/jmsg.cpp @@ -147,22 +147,18 @@ Java_org_simgrid_msg_Msg_init(JNIEnv * env, jclass cls, jobjectArray jargs) JNIEXPORT void JNICALL JNICALL Java_org_simgrid_msg_Msg_run(JNIEnv * env, jclass cls) { - msg_error_t rv; - xbt_dynar_t hosts, storages; - jobject jhost, jstorage; - /* Run everything */ XBT_DEBUG("Ready to run MSG_MAIN"); - rv = MSG_main(); + msg_error_t rv = MSG_main(); XBT_DEBUG("Done running MSG_MAIN"); jxbt_check_res("MSG_main()", rv, MSG_OK, xbt_strdup("unexpected error : MSG_main() failed .. please report this bug ")); XBT_INFO("MSG_main finished; Cleaning up the simulation..."); /* Cleanup java hosts */ - hosts = MSG_hosts_as_dynar(); + xbt_dynar_t hosts = MSG_hosts_as_dynar(); for (unsigned long index = 0; index < xbt_dynar_length(hosts) - 1; index++) { - jhost = (jobject) xbt_lib_get_level(xbt_dynar_get_as(hosts,index,msg_host_t), JAVA_HOST_LEVEL); + jobject jhost = (jobject) xbt_lib_get_level(xbt_dynar_get_as(hosts,index,msg_host_t), JAVA_HOST_LEVEL); if (jhost) jhost_unref(env, jhost); @@ -170,10 +166,10 @@ JNIEXPORT void JNICALL xbt_dynar_free(&hosts); /* Cleanup java storages */ - storages = MSG_storages_as_dynar(); + xbt_dynar_t storages = MSG_storages_as_dynar(); if(!xbt_dynar_is_empty(storages)){ for (unsigned long index = 0; index < xbt_dynar_length(storages) - 1; index++) { - jstorage = (jobject) xbt_lib_get_level(xbt_dynar_get_as(storages,index,msg_storage_t), JAVA_STORAGE_LEVEL); + jobject jstorage = (jobject) xbt_lib_get_level(xbt_dynar_get_as(storages,index,msg_storage_t), JAVA_STORAGE_LEVEL); if (jstorage) jstorage_unref(env, jstorage); } -- 2.20.1