summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ring.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/ring.c b/src/ring.c
index 9b6a69b..f15b582 100644
--- a/src/ring.c
+++ b/src/ring.c
@@ -162,14 +162,13 @@ zix_ring_read(ZixRing* ring, void* dst, uint32_t size)
{
const uint32_t r = ring->read_head;
const uint32_t w = ring->write_head;
-
- if (peek_internal(ring, r, w, size, dst)) {
- ZIX_READ_BARRIER();
- ring->read_head = (r + size) & ring->size_mask;
- return size;
+ if (!peek_internal(ring, r, w, size, dst)) {
+ return 0;
}
- return 0;
+ ZIX_READ_BARRIER();
+ ring->read_head = (r + size) & ring->size_mask;
+ return size;
}
uint32_t