aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@linaro.org>2024-07-22 13:37:48 +0200
committerPhilippe Mathieu-Daudé <philmd@linaro.org>2024-07-23 22:34:54 +0200
commite4e9db25624a93e8b02890a15bba0958db33c669 (patch)
treece69b71b37043df7b396f097ff8342305b4c92a2 /util
parent23ad5711730f994d66520a3283aac2979d89389e (diff)
util/fifo8: Introduce fifo8_drop()
Add the fifo8_drop() helper for clarity. It is a simple wrapper over fifo8_pop_buf(). Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Message-Id: <20240722160745.67904-8-philmd@linaro.org>
Diffstat (limited to 'util')
-rw-r--r--util/fifo8.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/util/fifo8.c b/util/fifo8.c
index a250ea9f80..1ffa19d900 100644
--- a/util/fifo8.c
+++ b/util/fifo8.c
@@ -131,6 +131,12 @@ uint32_t fifo8_pop_buf(Fifo8 *fifo, uint8_t *dest, uint32_t destlen)
return n1 + n2;
}
+void fifo8_drop(Fifo8 *fifo, uint32_t len)
+{
+ len -= fifo8_pop_buf(fifo, NULL, len);
+ assert(len == 0);
+}
+
bool fifo8_is_empty(Fifo8 *fifo)
{
return (fifo->num == 0);