diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-01-15 18:38:43 +0100 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-01-15 18:38:43 +0100 |
commit | 4075d0829e545ee92398bb2c21880efc7edb3b34 (patch) | |
tree | e556b8dab88b69f092dfe277a258af7841698749 | |
parent | abeae5bd62f3fae6995ec8711384583fe2187d71 (diff) |
Prefer nullptr in C23
-rw-r--r-- | da.h | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -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) \ |