Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of github.com:mquinson/simgrid
[simgrid.git] / src / mc / mc_global.cpp
index da49931..a77c614 100644 (file)
@@ -13,7 +13,7 @@
 
 #include "mc/mc.h"
 
-#ifndef _XBT_WIN32
+#ifndef _WIN32
 #include <unistd.h>
 #include <sys/wait.h>
 #include <sys/time.h>
@@ -112,9 +112,8 @@ void MC_init()
     MC_ignore_heap(mc_time, simix_process_maxpid * sizeof(double));
 
     smx_process_t process;
-    xbt_swag_foreach(process, simix_global->process_list) {
+    xbt_swag_foreach(process, simix_global->process_list)
       MC_ignore_heap(&(process->process_hookup), sizeof(process->process_hookup));
-    }
   }
 }
 
@@ -149,28 +148,25 @@ int MC_deadlock_check()
     ssize_t s = mc_model_checker->process().receive_message(message);
     if (s == -1)
       xbt_die("Could not receive message");
-    else if (s != sizeof(message) || message.type != MC_MESSAGE_DEADLOCK_CHECK_REPLY) {
+    if (s != sizeof(message) || message.type != MC_MESSAGE_DEADLOCK_CHECK_REPLY)
       xbt_die("%s received unexpected message %s (%i, size=%i) "
         "expected MC_MESSAGE_DEADLOCK_CHECK_REPLY (%i, size=%i)",
         MC_mode_name(mc_mode),
         MC_message_type_name(message.type), (int) message.type, (int) s,
         (int) MC_MESSAGE_DEADLOCK_CHECK_REPLY, (int) sizeof(message)
         );
-    }
-    else
-      return message.value;
+    return message.value;
   }
 
   int deadlock = FALSE;
   smx_process_t process;
   if (xbt_swag_size(simix_global->process_list)) {
     deadlock = TRUE;
-    xbt_swag_foreach(process, simix_global->process_list) {
+    xbt_swag_foreach(process, simix_global->process_list)
       if (MC_process_is_enabled(process)) {
         deadlock = FALSE;
         break;
       }
-    }
   }
   return deadlock;
 }
@@ -509,14 +505,11 @@ static void MC_dump_stacks(FILE* file)
 
 double MC_process_clock_get(smx_process_t process)
 {
-  if (mc_time) {
-    if (process != nullptr)
-      return mc_time[process->pid];
-    else
-      return -1;
-  } else {
+  if (!mc_time)
     return 0;
-  }
+  if (process != nullptr)
+    return mc_time[process->pid];
+  return -1;
 }
 
 void MC_process_clock_add(smx_process_t process, double amount)