rb_push write space checking
This commit is contained in:
parent
19abbbdb9c
commit
b042625d03
1 changed files with 1 additions and 1 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue