From db38111b3cc68a00514fc7e6601ad41d1e2b34d0 Mon Sep 17 00:00:00 2001 From: Imbus <> Date: Tue, 2 Jul 2024 05:42:44 +0200 Subject: [PATCH] Interface fix where MEMCPY_T parameter was forgotten in rb_pop_front --- ringbuf.c | 4 ++-- ringbuf.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ringbuf.c b/ringbuf.c index d0b4621..81c87c0 100644 --- a/ringbuf.c +++ b/ringbuf.c @@ -105,12 +105,12 @@ rb_push_many(struct RingBuf *rb, const void *items, MEMCPY_T memcpy_fn, } enum ReadResult -rb_pop_front(struct RingBuf *rb, void *item) +rb_pop_front(struct RingBuf *rb, void *item, MEMCPY_T memcpy_fn) { if(rb->count == 0) return Empty; - memcpy(item, rb->read_head, rb->struct_size); + memcpy_fn(item, rb->read_head, rb->struct_size); // Advance the read head rb->read_head = (char *)rb->read_head + rb->struct_size; diff --git a/ringbuf.h b/ringbuf.h index f374bac..bd1626b 100644 --- a/ringbuf.h +++ b/ringbuf.h @@ -77,7 +77,7 @@ enum WriteResult rb_push_many(struct RingBuf *rb, const void *items, * @param item The item to read into * @return ReadResult */ -enum ReadResult rb_pop_front(struct RingBuf *rb, void *item); +enum ReadResult rb_pop_front(struct RingBuf *rb, void *item, MEMCPY_T memcpy_fn); /** * @brief Free the ring buffer