From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43280) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W8zi8-0002td-Ni for qemu-devel@nongnu.org; Thu, 30 Jan 2014 17:03:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W8zi1-0001OM-Dc for qemu-devel@nongnu.org; Thu, 30 Jan 2014 17:03:48 -0500 Received: from mail-ea0-f172.google.com ([209.85.215.172]:55931) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W8zi1-0001OG-7H for qemu-devel@nongnu.org; Thu, 30 Jan 2014 17:03:41 -0500 Received: by mail-ea0-f172.google.com with SMTP id l9so766777eaj.3 for ; Thu, 30 Jan 2014 14:03:05 -0800 (PST) From: Beniamino Galvani Date: Thu, 30 Jan 2014 23:02:05 +0100 Message-Id: <1391119327-18190-3-git-send-email-b.galvani@gmail.com> In-Reply-To: <1391119327-18190-1-git-send-email-b.galvani@gmail.com> References: <1391119327-18190-1-git-send-email-b.galvani@gmail.com> Subject: [Qemu-devel] [PATCH v5 2/4] util/fifo8: clear fifo head upon reset List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Peter Crosthwaite , Stefan Hajnoczi , Beniamino Galvani , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Li Guang To improve the predictability of fifo8_pop_buf(), the fifo head is set to 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 --- 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.7.10.4