diff --git a/ringbuf.c b/ringbuf.c index 9c57e68..375b5d5 100644 --- a/ringbuf.c +++ b/ringbuf.c @@ -15,7 +15,7 @@ void rb_destroy(struct RingBuf *rb, int(free)(void *)) { free(rb->buffer); } enum WriteResult rb_push(struct RingBuf *rb, void *data[], int amount, int (*memcpy)(void *, const void *, int)) { - if (rb->write_idx == rb->read_idx) { + if (rb->write_idx + amount >= rb->capacity) { return CollisionError; }