From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47214) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCAIW-0007bR-AN for qemu-devel@nongnu.org; Sat, 08 Feb 2014 10:58:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WCAIV-0002x7-Ae for qemu-devel@nongnu.org; Sat, 08 Feb 2014 10:58:28 -0500 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:45684) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCAIV-0002tl-4o for qemu-devel@nongnu.org; Sat, 08 Feb 2014 10:58:27 -0500 From: Peter Maydell Date: Sat, 8 Feb 2014 15:58:01 +0000 Message-Id: <1391875084-12772-27-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1391875084-12772-1-git-send-email-peter.maydell@linaro.org> References: <1391875084-12772-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [PULL 26/29] util/fifo8: clear fifo head upon reset List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Blue Swirl , qemu-devel@nongnu.org, Aurelien Jarno From: Beniamino Galvani To improve the predictability of fifo8_pop_buf(), the fifo head is set to the start of data buffer upon a reset so that the first call to the function will be able to retrieve all data in the fifo. Signed-off-by: Beniamino Galvani Reviewed-by: Peter Crosthwaite Signed-off-by: Peter Maydell --- util/fifo8.c | 1 + 1 file changed, 1 insertion(+) diff --git a/util/fifo8.c b/util/fifo8.c index a7503c2..6a43482 100644 --- a/util/fifo8.c +++ b/util/fifo8.c @@ -89,6 +89,7 @@ const uint8_t *fifo8_pop_buf(Fifo8 *fifo, uint32_t max, uint32_t *num) void fifo8_reset(Fifo8 *fifo) { fifo->num = 0; + fifo->head = 0; } bool fifo8_is_empty(Fifo8 *fifo) -- 1.8.5