From: Martin Quinson Date: Sun, 2 Oct 2016 14:36:56 +0000 (+0200) Subject: more dupplicated code ritual sacrifice and cleanups X-Git-Tag: v3_14~377 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/4b29a552920278f287dca17fba2a33f7f30f4abc more dupplicated code ritual sacrifice and cleanups --- diff --git a/src/surf/ptask_L07.cpp b/src/surf/ptask_L07.cpp index 82a7e710a6..6fed9f2b43 100644 --- a/src/surf/ptask_L07.cpp +++ b/src/surf/ptask_L07.cpp @@ -73,25 +73,17 @@ NetworkL07Model::~NetworkL07Model() double HostL07Model::next_occuring_event(double /*now*/) { - L07Action *action; - - ActionList *running_actions = getRunningActionSet(); - double min = shareResourcesMaxMin(running_actions, maxminSystem_, bottleneck_solve); - - for(ActionList::iterator it(running_actions->begin()), itend(running_actions->end()); it != itend ; ++it) { - action = static_cast(&*it); - if (action->m_latency > 0) { - if (min < 0) { - min = action->m_latency; - XBT_DEBUG("Updating min (value) with %p (start %f): %f", action, action->getStartTime(), min); - } else if (action->m_latency < min) { - min = action->m_latency; - XBT_DEBUG("Updating min (latency) with %p (start %f): %f", action, action->getStartTime(), min); - } + ActionList *runningActions = getRunningActionSet(); + double min = shareResourcesMaxMin(runningActions, maxminSystem_, bottleneck_solve); + + for (auto it(runningActions->begin()), itend(runningActions->end()); it != itend ; ++it) { + L07Action *action = static_cast(&*it); + if (action->m_latency > 0 && (min < 0 || action->m_latency < min)) { + min = action->m_latency; + XBT_DEBUG("Updating min with %p (start %f): %f", action, action->getStartTime(), min); } } - - XBT_DEBUG("min value : %f", min); + XBT_DEBUG("min value: %f", min); return min; }