From: Martin Quinson Date: Mon, 20 Jun 2016 15:46:15 +0000 (+0200) Subject: make this loop sonarqube-complient X-Git-Tag: v3_14~931^2 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/b383052570bf2f171e76fbf038b0f85b63a987df?ds=sidebyside make this loop sonarqube-complient --- diff --git a/examples/s4u/actions-comm/s4u_actions-comm.cpp b/examples/s4u/actions-comm/s4u_actions-comm.cpp index cc773519aa..360112702f 100644 --- a/examples/s4u/actions-comm/s4u_actions-comm.cpp +++ b/examples/s4u/actions-comm/s4u_actions-comm.cpp @@ -55,10 +55,12 @@ static void asynchronous_cleanup(void) process_globals_t globals = (process_globals_t) MSG_process_get_data(MSG_process_self()); /* Destroy any isend which correspond to completed communications */ - int found; msg_comm_t comm; - while ((found = MSG_comm_testany(globals->isends)) != -1) { - xbt_dynar_remove_at(globals->isends, found, &comm); + while (true) { + int pos_found = MSG_comm_testany(globals->isends); + if (pos_found == -1) /* none remaining */ + break; + xbt_dynar_remove_at(globals->isends, pos_found, &comm); MSG_comm_destroy(comm); } }