rb_push write space checking

This commit is contained in:
Imbus 2024-06-23 14:29:33 +02:00
parent 19abbbdb9c
commit b042625d03

View file

@ -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, enum WriteResult rb_push(struct RingBuf *rb, void *data[], int amount,
int (*memcpy)(void *, const void *, int)) { int (*memcpy)(void *, const void *, int)) {
if (rb->write_idx == rb->read_idx) { if (rb->write_idx + amount >= rb->capacity) {
return CollisionError; return CollisionError;
} }