Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'actor-yield' of github.com:Takishipp/simgrid into actor-yield
[simgrid.git] / src / smpi / internals / smpi_global.cpp
index 0a66fcf..351269c 100644 (file)
@@ -371,7 +371,8 @@ void smpi_global_destroy()
   smpi_bench_destroy();
   smpi_shared_destroy();
   smpi_deployment_cleanup_instances();
-  for (int i = 0, count = smpi_process_count(); i < count; i++) {
+  int count = smpi_process_count();
+  for (int i = 0; i < count; i++) {
     if(process_data[i]->comm_self()!=MPI_COMM_NULL){
       simgrid::smpi::Comm::destroy(process_data[i]->comm_self());
     }
@@ -394,7 +395,7 @@ void smpi_global_destroy()
     xbt_os_timer_free(global_timer);
   }
 
-  xbt_free(index_to_process_data);
+  delete[] index_to_process_data;
   if(smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP)
     smpi_destroy_global_memory_segments();
   smpi_free_static();
@@ -461,17 +462,16 @@ static void smpi_init_options(){
     if (smpi_cpu_threshold < 0)
       smpi_cpu_threshold = DBL_MAX;
 
-    const char* val = xbt_cfg_get_string("smpi/shared-malloc").c_str();
-    if (not strcasecmp(val, "yes") || not strcmp(val, "1") || not strcasecmp(val, "on") ||
-        not strcasecmp(val, "global")) {
+    std::string val = xbt_cfg_get_string("smpi/shared-malloc");
+    if ((val == "yes") || (val == "1") || (val == "on") || (val == "global")) {
       smpi_cfg_shared_malloc = shmalloc_global;
-    } else if (not strcasecmp(val, "local")) {
+    } else if (val == "local") {
       smpi_cfg_shared_malloc = shmalloc_local;
-    } else if (not strcasecmp(val, "no") || not strcmp(val, "0") || not strcasecmp(val, "off")) {
+    } else if ((val == "no") || (val == "0") || (val == "off")) {
       smpi_cfg_shared_malloc = shmalloc_none;
     } else {
       xbt_die("Invalid value '%s' for option smpi/shared-malloc. Possible values: 'on' or 'global', 'local', 'off'",
-              val);
+              val.c_str());
     }
 }
 
@@ -659,7 +659,8 @@ int smpi_main(const char* executable, int argc, char *argv[])
     }
   }
   int ret   = 0;
-  for (int i = 0, count = smpi_process_count(); i < count; i++) {
+  int count = smpi_process_count();
+  for (int i = 0; i < count; i++) {
     if(process_data[i]->return_value()!=0){
       ret=process_data[i]->return_value();//return first non 0 value
       break;