diff options
Diffstat (limited to 'toxav/ring_buffer.c')
-rw-r--r-- | toxav/ring_buffer.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/toxav/ring_buffer.c b/toxav/ring_buffer.c index 2b76f2ba..7cb8996d 100644 --- a/toxav/ring_buffer.c +++ b/toxav/ring_buffer.c | |||
@@ -85,8 +85,9 @@ RingBuffer *rb_new(int size) | |||
85 | } | 85 | } |
86 | 86 | ||
87 | buf->size = size + 1; /* include empty elem */ | 87 | buf->size = size + 1; /* include empty elem */ |
88 | buf->data = (void **)calloc(buf->size, sizeof(void *)); | ||
88 | 89 | ||
89 | if (!(buf->data = (void **)calloc(buf->size, sizeof(void *)))) { | 90 | if (!buf->data) { |
90 | free(buf); | 91 | free(buf); |
91 | return nullptr; | 92 | return nullptr; |
92 | } | 93 | } |
@@ -118,7 +119,7 @@ uint16_t rb_data(const RingBuffer *b, void **dest) | |||
118 | { | 119 | { |
119 | uint16_t i = 0; | 120 | uint16_t i = 0; |
120 | 121 | ||
121 | for (; i < rb_size(b); i++) { | 122 | for (; i < rb_size(b); ++i) { |
122 | dest[i] = b->data[(b->start + i) % b->size]; | 123 | dest[i] = b->data[(b->start + i) % b->size]; |
123 | } | 124 | } |
124 | 125 | ||