From: Arnaud Giersch Date: Fri, 3 May 2019 12:18:43 +0000 (+0200) Subject: [sonar] Extract assignments from expressions. X-Git-Tag: v3.22.2~5 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/b2b47db238230f6841ab6398c1712bc7376dac70 [sonar] Extract assignments from expressions. --- diff --git a/src/mc/mc_state.cpp b/src/mc/mc_state.cpp index 436b425004..a30a6bb2b6 100644 --- a/src/mc/mc_state.cpp +++ b/src/mc/mc_state.cpp @@ -75,10 +75,12 @@ static inline smx_simcall_t MC_state_get_request_for_process(simgrid::mc::State* case SIMCALL_COMM_WAITANY: state->transition.argument = -1; while (procstate->times_considered < simcall_comm_waitany__get__count(&actor->simcall)) { - if (simgrid::mc::request_is_enabled_by_idx(&actor->simcall, procstate->times_considered++)) { - state->transition.argument = procstate->times_considered - 1; + if (simgrid::mc::request_is_enabled_by_idx(&actor->simcall, procstate->times_considered)) { + state->transition.argument = procstate->times_considered; + ++procstate->times_considered; break; } + ++procstate->times_considered; } if (procstate->times_considered >= simcall_comm_waitany__get__count(&actor->simcall)) @@ -90,11 +92,14 @@ static inline smx_simcall_t MC_state_get_request_for_process(simgrid::mc::State* case SIMCALL_COMM_TESTANY: { unsigned start_count = procstate->times_considered; state->transition.argument = -1; - while (procstate->times_considered < simcall_comm_testany__get__count(&actor->simcall)) - if (simgrid::mc::request_is_enabled_by_idx(&actor->simcall, procstate->times_considered++)) { - state->transition.argument = procstate->times_considered - 1; + while (procstate->times_considered < simcall_comm_testany__get__count(&actor->simcall)) { + if (simgrid::mc::request_is_enabled_by_idx(&actor->simcall, procstate->times_considered)) { + state->transition.argument = procstate->times_considered; + ++procstate->times_considered; break; } + ++procstate->times_considered; + } if (procstate->times_considered >= simcall_comm_testany__get__count(&actor->simcall)) procstate->setDone(); diff --git a/src/mc/sosp/mc_checkpoint.cpp b/src/mc/sosp/mc_checkpoint.cpp index e918993a67..58a0bb90ad 100644 --- a/src/mc/sosp/mc_checkpoint.cpp +++ b/src/mc/sosp/mc_checkpoint.cpp @@ -131,9 +131,11 @@ static void get_memory_regions(simgrid::mc::RemoteClient* process, simgrid::mc:: const size_t n = process->object_infos.size(); snapshot->snapshot_regions.resize(n + 1); int i = 0; - for (auto const& object_info : process->object_infos) - add_region(i++, snapshot, simgrid::mc::RegionType::Data, object_info.get(), object_info->start_rw, + for (auto const& object_info : process->object_infos) { + add_region(i, snapshot, simgrid::mc::RegionType::Data, object_info.get(), object_info->start_rw, object_info->start_rw, object_info->end_rw - object_info->start_rw); + ++i; + } xbt_mheap_t heap = process->get_heap(); void* start_heap = heap->base;