Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Avoid to return from inside a TRY block.
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Mon, 4 Feb 2013 14:05:27 +0000 (15:05 +0100)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Mon, 4 Feb 2013 15:27:13 +0000 (16:27 +0100)
src/bindings/java/jmsg_comm.c
src/instr/instr_paje_values.c

index 9fae142..669e91f 100644 (file)
@@ -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
index b6f1e60..6773dd9 100644 (file)
@@ -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)