mirror of
https://gitlab.com/qemu-project/qemu.git
synced 2024-12-02 18:42:58 +03:00
util/fifo8: Use fifo8_reset() in fifo8_create()
Avoid open-coding fifo8_reset() in fifo8_create(). Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Message-Id: <20240722160745.67904-4-philmd@linaro.org>
This commit is contained in:
parent
5ebf19430a
commit
b81bc8dc8d
15
util/fifo8.c
15
util/fifo8.c
@ -16,12 +16,17 @@
|
||||
#include "migration/vmstate.h"
|
||||
#include "qemu/fifo8.h"
|
||||
|
||||
void fifo8_reset(Fifo8 *fifo)
|
||||
{
|
||||
fifo->num = 0;
|
||||
fifo->head = 0;
|
||||
}
|
||||
|
||||
void fifo8_create(Fifo8 *fifo, uint32_t capacity)
|
||||
{
|
||||
fifo->data = g_new(uint8_t, capacity);
|
||||
fifo->capacity = capacity;
|
||||
fifo->head = 0;
|
||||
fifo->num = 0;
|
||||
fifo8_reset(fifo);
|
||||
}
|
||||
|
||||
void fifo8_destroy(Fifo8 *fifo)
|
||||
@ -97,12 +102,6 @@ const uint8_t *fifo8_pop_buf(Fifo8 *fifo, uint32_t max, uint32_t *numptr)
|
||||
return fifo8_peekpop_buf(fifo, max, numptr, true);
|
||||
}
|
||||
|
||||
void fifo8_reset(Fifo8 *fifo)
|
||||
{
|
||||
fifo->num = 0;
|
||||
fifo->head = 0;
|
||||
}
|
||||
|
||||
bool fifo8_is_empty(Fifo8 *fifo)
|
||||
{
|
||||
return (fifo->num == 0);
|
||||
|
Loading…
Reference in New Issue
Block a user