summaryrefslogtreecommitdiff
path: root/toxav/ring_buffer.c
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2020-03-02 15:06:12 +0000
committeriphydf <iphydf@users.noreply.github.com>2020-03-02 15:20:34 +0000
commite618829112a298d6a859369862f760f1b7e3dc11 (patch)
treedcbba36cc500806ea3745e6fdb026b9afc33d9ff /toxav/ring_buffer.c
parent0f7138c01006b35f2b1b477c30ae66ec243c21e1 (diff)
Add "cimple_test" to the bazel build.
Diffstat (limited to 'toxav/ring_buffer.c')
-rw-r--r--toxav/ring_buffer.c5
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