aboutsummaryrefslogtreecommitdiff
path: root/da.h
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-01-15 18:38:43 +0100
committerThomas Voss <mail@thomasvoss.com> 2024-01-15 18:38:43 +0100
commit4075d0829e545ee92398bb2c21880efc7edb3b34 (patch)
treee556b8dab88b69f092dfe277a258af7841698749 /da.h
parentabeae5bd62f3fae6995ec8711384583fe2187d71 (diff)
Prefer nullptr in C23
Diffstat (limited to 'da.h')
-rw-r--r--da.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/da.h b/da.h
index 2ed8cdb..57b7ed1 100644
--- a/da.h
+++ b/da.h
@@ -72,6 +72,12 @@
#include <stdlib.h>
#include <string.h>
+#if __STDC_VERSION__ >= 202311L
+# define DA_NULL nullptr
+#else
+# define DA_NULL NULL
+#endif
+
#define DA_ALLOC(p, n) \
do { \
if ((n) && SIZE_MAX / (n) < sizeof(*(p))) { \
@@ -84,7 +90,7 @@
#define dainit(a, n) \
do { \
- (a)->buf = NULL; \
+ (a)->buf = DA_NULL; \
(a)->cap = (n); \
(a)->len = 0; \
if (n) \