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