Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Remove useless check for null before free.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 7 May 2018 20:06:42 +0000 (22:06 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 7 May 2018 20:48:22 +0000 (22:48 +0200)
src/msg/msg_global.cpp
src/smpi/mpi/smpi_comm.cpp
src/surf/cpu_ti.cpp
src/surf/surf_interface.cpp
src/xbt/automaton/automatonparse_promela.c

index c90d181..cab13d9 100644 (file)
@@ -86,9 +86,6 @@ void MSG_config(const char *key, const char *value){
 }
 
 static void MSG_exit() {
-  if (msg_global==nullptr)
-    return;
-
   delete msg_global;
   msg_global = nullptr;
 }
index 5a7ddbb..2a80d4c 100644 (file)
@@ -265,10 +265,8 @@ void Comm::cleanup_smp(){
     Comm::unref(intra_comm_);
   if (leaders_comm_ != MPI_COMM_NULL)
     Comm::unref(leaders_comm_);
-  if (non_uniform_map_ != nullptr)
-    xbt_free(non_uniform_map_);
-  if (leaders_map_ != nullptr)
-    delete[] leaders_map_;
+  xbt_free(non_uniform_map_);
+  delete[] leaders_map_;
 }
 
 void Comm::unref(Comm* comm){
index ad16d13..c2827d3 100644 (file)
@@ -47,8 +47,7 @@ CpuTiTrace::~CpuTiTrace()
 
 CpuTiTmgr::~CpuTiTmgr()
 {
-  if (trace_)
-    delete trace_;
+  delete trace_;
 }
 
 /**
@@ -372,9 +371,7 @@ CpuTi::~CpuTi()
 }
 void CpuTi::set_speed_trace(tmgr_trace_t trace)
 {
-  if (speed_integrated_trace_)
-    delete speed_integrated_trace_;
-
+  delete speed_integrated_trace_;
   speed_integrated_trace_ = new CpuTiTmgr(trace, speed_.scale);
 
   /* add a fake trace event if periodicity == 0 */
index 5fb89fb..c85eba3 100644 (file)
@@ -317,11 +317,8 @@ void surf_exit()
     delete model;
   delete all_existing_models;
 
-
-  if (future_evt_set) {
-    delete future_evt_set;
-    future_evt_set = nullptr;
-  }
+  delete future_evt_set;
+  future_evt_set = nullptr;
 
   tmgr_finalize();
   sg_platf_exit();
index 939bfe9..6f59cb4 100644 (file)
@@ -44,8 +44,7 @@ static void new_state(char* id, int src){
     parsed_automaton->current_state = state;
 
   if(src) {
-    if (state_id_src)
-      xbt_free(state_id_src);
+    xbt_free(state_id_src);
     state_id_src = xbt_strdup(id);
   }
 }