From: Martin Quinson Date: Wed, 20 Jul 2016 18:22:33 +0000 (+0200) Subject: simplify a loop to please sonarqube X-Git-Tag: v3_14~737^2~5 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/9200323dff19fcdce0c80e27f8c05cdb1ac6dc70?ds=sidebyside simplify a loop to please sonarqube --- diff --git a/src/xbt/fifo.c b/src/xbt/fifo.c index 9e022d704c..8cd20e0a20 100644 --- a/src/xbt/fifo.c +++ b/src/xbt/fifo.c @@ -48,9 +48,13 @@ void xbt_fifo_free(xbt_fifo_t l) */ void xbt_fifo_reset(xbt_fifo_t l) { - xbt_fifo_item_t b, tmp; + xbt_fifo_item_t b = xbt_fifo_get_first_item(l); - for (b = xbt_fifo_get_first_item(l); b; tmp = b, b = b->next, xbt_fifo_free_item(tmp)); + while (b) { + xbt_fifo_item_t tmp = b; + b = b->next; + xbt_fifo_free_item(tmp); + } l->head = NULL; l->tail = NULL; }