From 9200323dff19fcdce0c80e27f8c05cdb1ac6dc70 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Wed, 20 Jul 2016 20:22:33 +0200 Subject: [PATCH] simplify a loop to please sonarqube --- src/xbt/fifo.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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; } -- 2.20.1