-/* Copyright (c) 2009-2022. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2009-2023. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
* new dependency
*/
- auto last_scheduled_task = sg_host_get_last_scheduled_task(selected_host);
- if (last_scheduled_task && (last_scheduled_task->get_state() != sg4::Activity::State::FINISHED) &&
+ if (auto last_scheduled_task = sg_host_get_last_scheduled_task(selected_host);
+ last_scheduled_task && (last_scheduled_task->get_state() != sg4::Activity::State::FINISHED) &&
(last_scheduled_task->get_state() != sg4::Activity::State::FAILED) &&
not dependency_exists(sg_host_get_last_scheduled_task(selected_host), selected_task))
last_scheduled_task->add_successor(selected_task);