Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Avoid shadowing outer variables.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 1 Mar 2019 13:03:40 +0000 (14:03 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 1 Mar 2019 22:56:51 +0000 (23:56 +0100)
17 files changed:
examples/deprecated/simdag/test/sd_test.cpp
src/kernel/lmm/lagrange.cpp
src/mc/ObjectInformation.cpp
src/mc/checker/Checker.cpp
src/mc/checker/CommunicationDeterminismChecker.cpp
src/mc/checker/LivenessChecker.cpp
src/mc/checker/SafetyChecker.cpp
src/mc/compare.cpp
src/mc/mc_dwarf.cpp
src/mc/mc_unw_vmread.cpp
src/mc/sosp/mc_checkpoint.cpp
src/plugins/host_energy.cpp
src/plugins/vm/VmLiveMigration.cpp
src/simdag/sd_dotloader.cpp
src/smpi/mpi/smpi_comm.cpp
src/surf/network_ib.cpp
src/surf/sg_platf.cpp

index 22f5fbf..2112647 100644 (file)
@@ -115,9 +115,8 @@ int main(int argc, char **argv)
   communication_amount[2] = comm_amount21;
 
   /* estimated time */
-  SD_task_t task = taskD;
-  XBT_INFO("Estimated time for '%s': %f", SD_task_get_name(task), SD_task_get_execution_time(task, 2, host_list,
-           computation_amount, communication_amount));
+  XBT_INFO("Estimated time for '%s': %f", SD_task_get_name(taskD),
+           SD_task_get_execution_time(taskD, 2, host_list, computation_amount, communication_amount));
 
   SD_task_schedule(taskA, 2, host_list, computation_amount, communication_amount, -1);
   SD_task_schedule(taskB, 2, host_list, computation_amount, communication_amount, -1);
index 755da62..9df8fb4 100644 (file)
@@ -403,19 +403,19 @@ double Lagrange::partial_diff_lambda(double lambda, const Constraint& cnst)
 
 /** @brief Attribute the value bound to var->bound.
  *
- *  @param func_f    function (f)
- *  @param func_fp   partial differential of f (f prime, (f'))
- *  @param func_fpi  inverse of the partial differential of f (f prime inverse, (f')^{-1})
+ *  @param f    function (f)
+ *  @param fp   partial differential of f (f prime, (f'))
+ *  @param fpi  inverse of the partial differential of f (f prime inverse, (f')^{-1})
  *
  *  Set default functions to the ones passed as parameters.
  */
-void Lagrange::set_default_protocol_function(double (*func_f)(const Variable& var, double x),
-                                             double (*func_fp)(const Variable& var, double x),
-                                             double (*func_fpi)(const Variable& var, double x))
+void Lagrange::set_default_protocol_function(double (*f)(const Variable& var, double x),
+                                             double (*fp)(const Variable& var, double x),
+                                             double (*fpi)(const Variable& var, double x))
 {
-  Lagrange::func_f   = func_f;
-  Lagrange::func_fp  = func_fp;
-  Lagrange::func_fpi = func_fpi;
+  func_f   = f;
+  func_fp  = fp;
+  func_fpi = fpi;
 }
 
 double (*Lagrange::func_f)(const Variable&, double);
index a8de56b..1f5e703 100644 (file)
@@ -108,11 +108,11 @@ void ObjectInformation::remove_global_variable(const char* name)
     if (cmp == 0) {
 
       // Find the whole range:
-      size_type first = cursor;
+      first = cursor;
       while (first != 0 && this->global_variables[first - 1].name == name)
         first--;
       size_type size = this->global_variables.size();
-      size_type last = cursor;
+      last           = cursor;
       while (last != size - 1 && this->global_variables[last + 1].name == name)
         last++;
 
index e7e5739..6ca26a6 100644 (file)
@@ -14,7 +14,7 @@
 namespace simgrid {
 namespace mc {
 
-Checker::Checker(Session& session) : session_(&session)
+Checker::Checker(Session& s) : session_(&s)
 {
   xbt_assert(mc_model_checker);
   xbt_assert(mc_model_checker->getChecker() == nullptr);
index 0b3c59a..082678e 100644 (file)
@@ -292,7 +292,7 @@ void CommunicationDeterminismChecker::complete_comm_pattern(
   }
 }
 
-CommunicationDeterminismChecker::CommunicationDeterminismChecker(Session& session) : Checker(session)
+CommunicationDeterminismChecker::CommunicationDeterminismChecker(Session& s) : Checker(s)
 {
 }
 
@@ -385,10 +385,10 @@ static inline bool all_communications_are_finished()
 void CommunicationDeterminismChecker::restoreState()
 {
   /* Intermediate backtracking */
-  simgrid::mc::State* state = stack_.back().get();
-  if (state->system_state) {
-    simgrid::mc::restore_snapshot(state->system_state);
-    MC_restore_communications_pattern(state);
+  simgrid::mc::State* last_state = stack_.back().get();
+  if (last_state->system_state) {
+    simgrid::mc::restore_snapshot(last_state->system_state);
+    MC_restore_communications_pattern(last_state);
     return;
   }
 
@@ -437,23 +437,23 @@ void CommunicationDeterminismChecker::real_run()
 
   while (not stack_.empty()) {
     /* Get current state */
-    simgrid::mc::State* state = stack_.back().get();
+    simgrid::mc::State* cur_state = stack_.back().get();
 
     XBT_DEBUG("**************************************************");
-    XBT_DEBUG("Exploration depth = %zu (state = %d, interleaved processes = %zu)", stack_.size(), state->num,
-              state->interleaveSize());
+    XBT_DEBUG("Exploration depth = %zu (state = %d, interleaved processes = %zu)", stack_.size(), cur_state->num,
+              cur_state->interleaveSize());
 
     /* Update statistics */
     mc_model_checker->visited_states++;
 
     if (stack_.size() <= (std::size_t)_sg_mc_max_depth)
-      req = MC_state_get_request(state);
+      req = MC_state_get_request(cur_state);
     else
       req = nullptr;
 
     if (req != nullptr && visited_state == nullptr) {
 
-      int req_num = state->transition.argument;
+      int req_num = cur_state->transition.argument;
 
       XBT_DEBUG("Execute: %s", simgrid::mc::request_to_string(req, req_num, simgrid::mc::RequestType::simix).c_str());
 
@@ -469,7 +469,7 @@ void CommunicationDeterminismChecker::real_run()
         call = MC_get_call_type(req);
 
       /* Answer the request */
-      mc_model_checker->handle_simcall(state->transition);
+      mc_model_checker->handle_simcall(cur_state->transition);
       /* After this call req is no longer useful */
 
       MC_handle_comm_pattern(call, req, req_num, 0);
@@ -499,11 +499,10 @@ void CommunicationDeterminismChecker::real_run()
             next_state->addInterleavingSet(actor.copy.getBuffer());
 
         if (dot_output != nullptr)
-          fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n",
-            state->num,  next_state->num, req_str.c_str());
+          fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n", cur_state->num, next_state->num, req_str.c_str());
 
       } else if (dot_output != nullptr)
-        fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n", state->num,
+        fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n", cur_state->num,
                 visited_state->original_num == -1 ? visited_state->num : visited_state->original_num, req_str.c_str());
 
       stack_.push_back(std::move(next_state));
@@ -522,7 +521,7 @@ void CommunicationDeterminismChecker::real_run()
         this->initial_communications_pattern_done = 1;
 
       /* Trash the current state, no longer needed */
-      XBT_DEBUG("Delete state %d at depth %zu", state->num, stack_.size());
+      XBT_DEBUG("Delete state %d at depth %zu", cur_state->num, stack_.size());
       stack_.pop_back();
 
       visited_state = nullptr;
@@ -566,9 +565,9 @@ void CommunicationDeterminismChecker::run()
   this->real_run();
 }
 
-Checker* createCommunicationDeterminismChecker(Session& session)
+Checker* createCommunicationDeterminismChecker(Session& s)
 {
-  return new CommunicationDeterminismChecker(session);
+  return new CommunicationDeterminismChecker(s);
 }
 
 }
index a425ad6..5875f80 100644 (file)
@@ -251,7 +251,7 @@ void LivenessChecker::purgeVisitedPairs()
   }
 }
 
-LivenessChecker::LivenessChecker(Session& session) : Checker(session)
+LivenessChecker::LivenessChecker(Session& s) : Checker(s)
 {
 }
 
@@ -446,8 +446,9 @@ void LivenessChecker::run()
 
     // For each enabled transition in the property automaton, push a
     // (application_state, automaton_state) pair to the exploration stack:
-    for (int cursor = xbt_dynar_length(current_pair->automaton_state->out) - 1; cursor >= 0; cursor--) {
-      xbt_automaton_transition_t transition_succ = (xbt_automaton_transition_t)xbt_dynar_get_as(current_pair->automaton_state->out, cursor, xbt_automaton_transition_t);
+    for (int i = xbt_dynar_length(current_pair->automaton_state->out) - 1; i >= 0; i--) {
+      xbt_automaton_transition_t transition_succ = (xbt_automaton_transition_t)xbt_dynar_get_as(
+          current_pair->automaton_state->out, i, xbt_automaton_transition_t);
       if (evaluate_label(transition_succ->label, *prop_values))
           explorationStack_.push_back(this->newPair(
             current_pair.get(), transition_succ->dst, prop_values));
@@ -459,9 +460,9 @@ void LivenessChecker::run()
   simgrid::mc::session->logState();
 }
 
-Checker* createLivenessChecker(Session& session)
+Checker* createLivenessChecker(Session& s)
 {
-  return new LivenessChecker(session);
+  return new LivenessChecker(s);
 }
 
 }
index b834403..079f3fe 100644 (file)
@@ -269,9 +269,9 @@ void SafetyChecker::backtrack()
 void SafetyChecker::restoreState()
 {
   /* Intermediate backtracking */
-  simgrid::mc::State* state = stack_.back().get();
-  if (state->system_state) {
-    simgrid::mc::restore_snapshot(state->system_state);
+  simgrid::mc::State* last_state = stack_.back().get();
+  if (last_state->system_state) {
+    simgrid::mc::restore_snapshot(last_state->system_state);
     return;
   }
 
@@ -289,7 +289,7 @@ void SafetyChecker::restoreState()
   }
 }
 
-SafetyChecker::SafetyChecker(Session& session) : Checker(session)
+SafetyChecker::SafetyChecker(Session& s) : Checker(s)
 {
   reductionMode_ = simgrid::mc::reduction_mode;
   if (_sg_mc_termination)
@@ -324,9 +324,9 @@ SafetyChecker::SafetyChecker(Session& session) : Checker(session)
   stack_.push_back(std::move(initial_state));
 }
 
-Checker* createSafetyChecker(Session& session)
+Checker* createSafetyChecker(Session& s)
 {
-  return new SafetyChecker(session);
+  return new SafetyChecker(s);
 }
 
 }
index a209a61..1f1512b 100644 (file)
@@ -708,7 +708,6 @@ static int compare_heap_area_with_type(
 
     simgrid::mc::Type* subtype;
     simgrid::mc::Type* subsubtype;
-    int res;
     int elm_size;
     const void* addr_pointed1;
     const void* addr_pointed2;
@@ -777,9 +776,9 @@ static int compare_heap_area_with_type(
         }
         for (int i = 0; i < type->element_count; i++) {
           // TODO, add support for variable stride (DW_AT_byte_stride)
-          res = compare_heap_area_with_type(state, process_index, (char*)real_area1 + (i * elm_size),
-                                            (char*)real_area2 + (i * elm_size), snapshot1, snapshot2, previous,
-                                            type->subtype, subtype->byte_size, check_ignore, pointer_level);
+          int res = compare_heap_area_with_type(state, process_index, (char*)real_area1 + (i * elm_size),
+                                                (char*)real_area2 + (i * elm_size), snapshot1, snapshot2, previous,
+                                                type->subtype, subtype->byte_size, check_ignore, pointer_level);
           if (res == 1)
             return res;
         }
@@ -807,6 +806,7 @@ static int compare_heap_area_with_type(
         for (size_t i = 0; i < (area_size / sizeof(void*)); i++) {
           addr_pointed1 = snapshot1->read(remote((void**)((char*)real_area1 + i * sizeof(void*))), process_index);
           addr_pointed2 = snapshot2->read(remote((void**)((char*)real_area2 + i * sizeof(void*))), process_index);
+          int res;
           if (addr_pointed1 > state.std_heap_copy.heapbase && addr_pointed1 < mc_snapshot_get_heap_end(snapshot1) &&
               addr_pointed2 > state.std_heap_copy.heapbase && addr_pointed2 < mc_snapshot_get_heap_end(snapshot2))
             res = compare_heap_area(state, process_index, addr_pointed1, addr_pointed2, snapshot1, snapshot2, previous,
@@ -1377,12 +1377,9 @@ static int compare_global_variables(
       && process_count == r2->privatized_data().size());
 
     // Compare the global variables separately for each simulates process:
-    for (size_t process_index = 0; process_index < process_count; process_index++) {
-      if (compare_global_variables(state,
-          object_info, process_index,
-          &r1->privatized_data()[process_index],
-          &r2->privatized_data()[process_index],
-          snapshot1, snapshot2))
+    for (size_t i = 0; i < process_count; i++) {
+      if (compare_global_variables(state, object_info, i, &r1->privatized_data()[i], &r2->privatized_data()[i],
+                                   snapshot1, snapshot2))
         return 1;
     }
     return 0;
index 59655e8..40d650a 100644 (file)
@@ -774,8 +774,8 @@ static std::unique_ptr<simgrid::mc::Variable> MC_die_to_variable(simgrid::mc::Ob
   if (dwarf_hasattr(die, DW_AT_start_scope)) {
     Dwarf_Attribute attr;
     dwarf_attr(die, DW_AT_start_scope, &attr);
-    int form = dwarf_whatform(&attr);
-    simgrid::dwarf::FormClass form_class = simgrid::dwarf::classify_form(form);
+    form       = dwarf_whatform(&attr);
+    form_class = simgrid::dwarf::classify_form(form);
     if (form_class == simgrid::dwarf::FormClass::Constant) {
       Dwarf_Word value;
       variable->start_scope = dwarf_formudata(&attr, &value) == 0 ? (size_t)value : 0;
@@ -1187,7 +1187,7 @@ void MC_load_dwarf(simgrid::mc::ObjectInformation* info)
     fd = open(debug_file.c_str(), O_RDONLY);
     if (fd < 0)
       xbt_die("Could not open file %s", debug_file.c_str());
-    Dwarf* dwarf = dwarf_begin(fd, DWARF_C_READ);
+    dwarf = dwarf_begin(fd, DWARF_C_READ);
     if (dwarf == nullptr)
       xbt_die("No DWARF info in %s for %s",
         debug_file.c_str(), info->file_name.c_str());
@@ -1327,9 +1327,9 @@ std::shared_ptr<simgrid::mc::ObjectInformation> createObjectInformation(
 
 void postProcessObjectInformation(simgrid::mc::RemoteClient* process, simgrid::mc::ObjectInformation* info)
 {
-  for (auto& i : info->types) {
+  for (auto& t : info->types) {
 
-    simgrid::mc::Type* type = &(i.second);
+    simgrid::mc::Type* type    = &(t.second);
     simgrid::mc::Type* subtype = type;
     while (subtype->type == DW_TAG_typedef
         || subtype->type == DW_TAG_volatile_type
index 3f37e2a..1e7674c 100644 (file)
@@ -78,16 +78,16 @@ static int access_mem(const unw_addr_space_t as,
   if (fd < 0)
     return - UNW_EINVAL;
   while (1) {
-    ssize_t s = pread(fd, buf, count, off);
-    if (s == 0) {
+    ssize_t nread = pread(fd, buf, count, off);
+    if (nread == 0) {
       close(fd);
       return - UNW_EINVAL;
     }
-    if (s == -1)
+    if (nread == -1)
       break;
-    count -= s;
-    buf += s;
-    off += s;
+    count -= nread;
+    buf += nread;
+    off += nread;
     if (count == 0) {
       close(fd);
       return 0;
index 8a20452..26e07f5 100644 (file)
@@ -419,7 +419,8 @@ static std::vector<s_fd_infos_t> get_current_fds(pid_t pid)
 {
   const size_t fd_dir_path_size = 20;
   char fd_dir_path[fd_dir_path_size];
-  int res = snprintf(fd_dir_path, fd_dir_path_size, "/proc/%lli/fd", (long long int)pid);
+  int res;
+  res = snprintf(fd_dir_path, fd_dir_path_size, "/proc/%lli/fd", (long long int)pid);
   xbt_assert(res >= 0);
   if ((size_t)res > fd_dir_path_size)
     xbt_die("Unexpected buffer is too small for fd_dir_path");
@@ -440,7 +441,7 @@ static std::vector<s_fd_infos_t> get_current_fds(pid_t pid)
 
     const size_t source_size = 25;
     char source[25];
-    int res = snprintf(source, source_size, "/proc/%lli/fd/%s", (long long int)pid, fd_number->d_name);
+    res = snprintf(source, source_size, "/proc/%lli/fd/%s", (long long int)pid, fd_number->d_name);
     xbt_assert(res >= 0);
     if ((size_t)res > source_size)
       xbt_die("Unexpected buffer is too small for fd %s", fd_number->d_name);
index 3a81ebe..f10c827 100644 (file)
@@ -290,10 +290,10 @@ double HostEnergy::get_current_watts_value(double cpu_load)
   /* min_power corresponds to the power consumed when only one core is active */
   /* max_power is the power consumed at 100% cpu load       */
   auto range           = power_range_watts_list_.at(this->pstate_);
-  double current_power = 0;
-  double min_power     = 0;
-  double max_power     = 0;
-  double power_slope   = 0;
+  double current_power;
+  double min_power;
+  double max_power;
+  double power_slope;
 
   if (cpu_load > 0) { /* Something is going on, the machine is not idle */
     min_power = range.min_;
@@ -309,7 +309,6 @@ double HostEnergy::get_current_watts_value(double cpu_load)
      * i.e., we need min_power + (maxCpuLoad-1/coreCount)*power_slope == max_power
      * (maxCpuLoad is by definition 1)
      */
-    double power_slope;
     int coreCount         = host_->get_core_count();
     double coreReciprocal = static_cast<double>(1) / static_cast<double>(coreCount);
     if (coreCount > 1)
@@ -319,6 +318,9 @@ double HostEnergy::get_current_watts_value(double cpu_load)
 
     current_power = min_power + (cpu_load - coreReciprocal) * power_slope;
   } else { /* Our machine is idle, take the dedicated value! */
+    min_power     = 0;
+    max_power     = 0;
+    power_slope   = 0;
     current_power = range.idle_;
   }
 
index c6b7881..825284f 100644 (file)
@@ -146,7 +146,11 @@ void MigrationTx::operator()()
   bool skip_stage2   = false;
 
   size_t remaining_size = ramsize;
-  size_t threshold      = 0.0;
+
+  double clock_prev_send;
+  double clock_post_send;
+  double bandwidth;
+  size_t threshold;
 
   /* check parameters */
   if (ramsize == 0)
@@ -162,7 +166,7 @@ void MigrationTx::operator()()
   sg_vm_start_dirty_page_tracking(vm_);
 
   double computed_during_stage1 = 0;
-  double clock_prev_send        = s4u::Engine::get_clock();
+  clock_prev_send               = s4u::Engine::get_clock();
 
   try {
     /* At stage 1, we do not need timeout. We have to send all the memory pages even though the duration of this
@@ -185,7 +189,7 @@ void MigrationTx::operator()()
     return;
   }
 
-  double clock_post_send = s4u::Engine::get_clock();
+  clock_post_send = s4u::Engine::get_clock();
   mig_timeout -= (clock_post_send - clock_prev_send);
   if (mig_timeout < 0) {
     XBT_VERB("The duration of stage 1 exceeds the timeout value, skip stage 2");
@@ -193,8 +197,8 @@ void MigrationTx::operator()()
   }
 
   /* estimate bandwidth */
-  double bandwidth = ramsize / (clock_post_send - clock_prev_send);
-  threshold        = bandwidth * max_downtime;
+  bandwidth = ramsize / (clock_post_send - clock_prev_send);
+  threshold = bandwidth * max_downtime;
   XBT_DEBUG("actual bandwidth %f (MB/s), threshold %zu", bandwidth / 1024 / 1024, threshold);
 
   /* Stage2: send update pages iteratively until the size of remaining states becomes smaller than threshold value. */
@@ -221,8 +225,8 @@ void MigrationTx::operator()()
       if (remaining_size < threshold)
         break;
 
-      sg_size_t sent         = 0;
-      double clock_prev_send = s4u::Engine::get_clock();
+      sg_size_t sent  = 0;
+      clock_prev_send = s4u::Engine::get_clock();
       try {
         XBT_DEBUG("Stage 2, gonna send %llu", updated_size);
         sent = sendMigrationData(updated_size, 2, stage2_round, mig_speed, mig_timeout);
@@ -233,12 +237,12 @@ void MigrationTx::operator()()
         sg_vm_stop_dirty_page_tracking(vm_);
         return;
       }
-      double clock_post_send = s4u::Engine::get_clock();
+      clock_post_send = s4u::Engine::get_clock();
 
       if (sent == updated_size) {
         /* timeout did not happen */
-        double bandwidth = updated_size / (clock_post_send - clock_prev_send);
-        threshold        = bandwidth * max_downtime;
+        bandwidth = updated_size / (clock_post_send - clock_prev_send);
+        threshold = bandwidth * max_downtime;
         XBT_DEBUG("actual bandwidth %f, threshold %zu", bandwidth / 1024 / 1024, threshold);
         remaining_size -= sent;
         stage2_round += 1;
index ef435c4..536d34b 100644 (file)
@@ -217,14 +217,14 @@ xbt_dynar_t SD_dotload_generic(const char* filename, bool sequential, bool sched
 
       for (auto const& elm : computers) {
         SD_task_t previous_task = nullptr;
-        for (auto const& task : *elm.second) {
+        for (auto const& cur_task : *elm.second) {
           /* add dependency between the previous and the task to avoid parallel execution */
-          if(task){
-            if (previous_task && not SD_task_dependency_exists(previous_task, task))
-              SD_task_dependency_add(previous_task, task);
+          if (cur_task) {
+            if (previous_task && not SD_task_dependency_exists(previous_task, cur_task))
+              SD_task_dependency_add(previous_task, cur_task);
 
-            SD_task_schedulel(task, 1, hosts[atoi(elm.first.c_str())]);
-            previous_task = task;
+            SD_task_schedulel(cur_task, 1, hosts[std::stod(elm.first)]);
+            previous_task = cur_task;
           }
         }
         delete elm.second;
index 5e03b53..97cb033 100644 (file)
@@ -196,13 +196,13 @@ MPI_Comm Comm::split(int color, int key)
   MPI_Group group_root = nullptr;
   MPI_Group group_out  = nullptr;
   MPI_Group group      = this->group();
-  int rank             = this->rank();
+  int myrank           = this->rank();
   int size             = this->size();
   /* Gather all colors and keys on rank 0 */
   int* sendbuf = xbt_new(int, 2);
   sendbuf[0] = color;
   sendbuf[1] = key;
-  if(rank == 0) {
+  if (myrank == 0) {
     recvbuf = xbt_new(int, 2 * size);
   } else {
     recvbuf = nullptr;
@@ -210,7 +210,7 @@ MPI_Comm Comm::split(int color, int key)
   Coll_gather_default::gather(sendbuf, 2, MPI_INT, recvbuf, 2, MPI_INT, 0, this);
   xbt_free(sendbuf);
   /* Do the actual job */
-  if(rank == 0) {
+  if (myrank == 0) {
     MPI_Group* group_snd = xbt_new(MPI_Group, size);
     std::vector<std::pair<int, int>> rankmap;
     rankmap.reserve(size);
index 7d5efb2..19bb9cd 100644 (file)
@@ -204,7 +204,6 @@ void NetworkIBModel::updateIBfactors(NetworkAction* action, IBNode* from, IBNode
   if (from == to) // disregard local comms (should use loopback)
     return;
 
-  ActiveComm* comm = nullptr;
   if (remove) {
     if (to->ActiveCommsDown[from] == 1)
       to->ActiveCommsDown.erase(from);
@@ -214,8 +213,8 @@ void NetworkIBModel::updateIBfactors(NetworkAction* action, IBNode* from, IBNode
     to->nbActiveCommsDown--;
     for (std::vector<ActiveComm*>::iterator it = from->ActiveCommsUp.begin(); it != from->ActiveCommsUp.end(); ++it) {
       if ((*it)->action == action) {
-        comm = (*it);
         from->ActiveCommsUp.erase(it);
+        delete *it;
         break;
       }
     }
@@ -234,7 +233,6 @@ void NetworkIBModel::updateIBfactors(NetworkAction* action, IBNode* from, IBNode
   std::vector<bool> updated(active_nodes.size(), false);
   updateIBfactors_rec(from, updated);
   XBT_DEBUG("IB - Finished updating %d", from->id);
-  delete comm;
 }
 }
 }
index e3379c9..1abeb14 100644 (file)
@@ -94,8 +94,6 @@ void sg_platf_new_host(simgrid::kernel::routing::HostCreationArgs* args)
 /** @brief Add a "router" to the network element list */
 simgrid::kernel::routing::NetPoint* sg_platf_new_router(std::string name, const char* coords)
 {
-  simgrid::kernel::routing::NetZoneImpl* current_routing = routing_get_current();
-
   if (current_routing->hierarchy_ == simgrid::kernel::routing::NetZoneImpl::RoutingMode::unset)
     current_routing->hierarchy_ = simgrid::kernel::routing::NetZoneImpl::RoutingMode::base;
   xbt_assert(nullptr == simgrid::s4u::Engine::get_instance()->netpoint_by_name_or_null(name),
@@ -420,8 +418,8 @@ void sg_platf_new_actor(simgrid::kernel::routing::ActorCreationArgs* actor)
 
     std::vector<simgrid::s4u::Host*> list = simgrid::s4u::Engine::get_instance()->get_all_hosts();
 
-    for (auto const& host : list) {
-      msg += host->get_name();
+    for (auto const& some_host : list) {
+      msg += some_host->get_name();
       msg += "', '";
       if (msg.length() > 1024) {
         msg.pop_back(); // remove trailing quote
@@ -464,19 +462,17 @@ void sg_platf_new_actor(simgrid::kernel::routing::ActorCreationArgs* actor)
   } else {                      // start_time <= SIMIX_get_clock()
     XBT_DEBUG("Starting Process %s(%s) right now", arg->name.c_str(), host->get_cname());
 
-    simgrid::kernel::actor::ActorImplPtr actor = nullptr;
     try {
-      actor = simgrid::kernel::actor::ActorImpl::create(arg->name.c_str(), std::move(code), nullptr, host,
-                                                        arg->properties.get(), nullptr);
-    } catch (simgrid::HostFailureException const&) {
-      XBT_WARN("Deployment includes some initially turned off Hosts ... nevermind.");
-    }
-    /* The actor creation will fail if the host is currently dead, but that's fine */
-    if (actor != nullptr) {
+      simgrid::kernel::actor::ActorImplPtr new_actor = nullptr;
+      new_actor = simgrid::kernel::actor::ActorImpl::create(arg->name.c_str(), std::move(code), nullptr, host,
+                                                            arg->properties.get(), nullptr);
+      /* The actor creation will fail if the host is currently dead, but that's fine */
       if (arg->kill_time >= 0)
-        actor->set_kill_time(arg->kill_time);
+        new_actor->set_kill_time(arg->kill_time);
       if (auto_restart)
-        actor->set_auto_restart(auto_restart);
+        new_actor->set_auto_restart(auto_restart);
+    } catch (simgrid::HostFailureException const&) {
+      XBT_WARN("Deployment includes some initially turned off Hosts ... nevermind.");
     }
   }
 }