From 6d14c1a0c31bf23b35ec3df2ebc361fc965591b3 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Mon, 4 Feb 2013 15:05:27 +0100 Subject: [PATCH] Avoid to return from inside a TRY block. --- src/bindings/java/jmsg_comm.c | 29 +++++++++-------------------- src/instr/instr_paje_values.c | 7 ++++--- 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/src/bindings/java/jmsg_comm.c b/src/bindings/java/jmsg_comm.c index 9fae1424a3..669e91f407 100644 --- a/src/bindings/java/jmsg_comm.c +++ b/src/bindings/java/jmsg_comm.c @@ -82,28 +82,17 @@ Java_org_simgrid_msg_Comm_test(JNIEnv *env, jobject jcomm) { jxbt_throw_native(env,bprintf("comm is null")); return JNI_FALSE; } - xbt_ex_t e; - TRY { - if (MSG_comm_test(comm)) { - msg_error_t status = MSG_comm_get_status(comm); - if (status == MSG_OK) { - jcomm_bind_task(env,jcomm); - return JNI_TRUE; - } - else { - //send the correct exception - jmsg_throw_status(env,status); - return JNI_FALSE; - } - } - else { - return JNI_FALSE; + + if (MSG_comm_test(comm)) { + msg_error_t status = MSG_comm_get_status(comm); + if (status == MSG_OK) { + jcomm_bind_task(env,jcomm); + return JNI_TRUE; + } else { + //send the correct exception + jmsg_throw_status(env,status); } } - CATCH(e) { - xbt_ex_free(e); - } - return JNI_FALSE; } JNIEXPORT void JNICALL diff --git a/src/instr/instr_paje_values.c b/src/instr/instr_paje_values.c index b6f1e60d14..6773dd9648 100644 --- a/src/instr/instr_paje_values.c +++ b/src/instr/instr_paje_values.c @@ -32,15 +32,16 @@ val_t PJ_value_new (const char *name, const char *color, type_t father) val_t PJ_value_get_or_new (const char *name, const char *color, type_t father) { + val_t ret = 0; xbt_ex_t e; TRY { - return PJ_value_get(name, father); + ret = PJ_value_get(name, father); } CATCH(e) { xbt_ex_free(e); - return PJ_value_new(name, color, father); + ret = PJ_value_new(name, color, father); } - THROW_IMPOSSIBLE; + return ret; } val_t PJ_value_get (const char *name, type_t father) -- 2.20.1