summaryrefslogtreecommitdiffstats
path: root/test/ring_test.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-09-10 20:11:46 -0400
committerDavid Robillard <d@drobilla.net>2021-09-10 20:54:28 -0400
commit904c1b4d699aeb1ce170f0cd996a01d2d06812e3 (patch)
tree35a4a9f75a395a958ab0ea5fffeca81ce733bbc1 /test/ring_test.c
parent1f8c8118f2d42f495dbe6e3adb2a95c87a92e8e0 (diff)
downloadzix-904c1b4d699aeb1ce170f0cd996a01d2d06812e3.tar.gz
zix-904c1b4d699aeb1ce170f0cd996a01d2d06812e3.tar.bz2
zix-904c1b4d699aeb1ce170f0cd996a01d2d06812e3.zip
Add nullability annotations
This allows clang to issue warnings at compile time when null is passed to a non-null parameter. For public entry points, also add assertions to catch such issues when the compiler does not support this.
Diffstat (limited to 'test/ring_test.c')
-rw-r--r--test/ring_test.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/ring_test.c b/test/ring_test.c
index 49cf4f0..61a6d1f 100644
--- a/test/ring_test.c
+++ b/test/ring_test.c
@@ -18,6 +18,7 @@
#include "zix/ring.h"
#include "zix/thread.h"
+#include <assert.h>
#include <limits.h>
#include <stdarg.h>
#include <stdbool.h>
@@ -137,6 +138,7 @@ main(int argc, char** argv)
size);
ring = zix_ring_new(size);
+ assert(ring);
if (zix_ring_read_space(ring) != 0) {
return failure("New ring is not empty\n");
}
@@ -163,6 +165,7 @@ main(int argc, char** argv)
return failure("Read error\n");
}
+ assert(ring);
zix_ring_reset(ring);
if (zix_ring_read_space(ring) > 0) {
return failure("Reset did not empty ring.\n");