From 92ffad1a72bc8c422426d52ac408bd71242dd047 Mon Sep 17 00:00:00 2001 From: iphydf Date: Sun, 28 Jan 2018 21:30:39 +0000 Subject: Use nullptr as NULL pointer constant instead of NULL or 0. This changes only code, no string literals or comments. --- toxav/ring_buffer.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'toxav/ring_buffer.c') diff --git a/toxav/ring_buffer.c b/toxav/ring_buffer.c index c60c21f2..d3f013c6 100644 --- a/toxav/ring_buffer.c +++ b/toxav/ring_buffer.c @@ -21,6 +21,8 @@ */ #include "ring_buffer.h" +#include "../toxcore/ccompat.h" + #include struct RingBuffer { @@ -46,7 +48,7 @@ bool rb_empty(const RingBuffer *b) */ void *rb_write(RingBuffer *b, void *p) { - void *rc = NULL; + void *rc = nullptr; if ((b->end + 1) % b->size == b->start) { /* full */ rc = b->data[b->start]; @@ -65,7 +67,7 @@ void *rb_write(RingBuffer *b, void *p) bool rb_read(RingBuffer *b, void **p) { if (b->end == b->start) { /* Empty */ - *p = NULL; + *p = nullptr; return false; } @@ -79,14 +81,14 @@ RingBuffer *rb_new(int size) RingBuffer *buf = (RingBuffer *)calloc(sizeof(RingBuffer), 1); if (!buf) { - return NULL; + return nullptr; } buf->size = size + 1; /* include empty elem */ if (!(buf->data = (void **)calloc(buf->size, sizeof(void *)))) { free(buf); - return NULL; + return nullptr; } return buf; -- cgit v1.2.3