aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2023-12-30 14:14:38 +0100
committerThomas Voss <mail@thomasvoss.com> 2023-12-30 14:14:38 +0100
commit2ed553ef4cfe020a4c38a41d443d1d507a710529 (patch)
tree13bf43f7071bb3c0aa18aa3c1865ea92ff188954
parent24fdae54988518c4ddbb833c1675fe1977104af6 (diff)
Use clangs _Nullable
-rw-r--r--cbs.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/cbs.h b/cbs.h
index f04be48..088cb55 100644
--- a/cbs.h
+++ b/cbs.h
@@ -82,6 +82,12 @@
# define ATTR_FMT
#endif
+/* Clang defines this attribute, and while it does nothing it does serve as
+ good documentation. */
+#ifndef _Nullable
+# define _Nullable
+#endif
+
/* Internal global versions of argc and argv, so our functions and macros can
access them from anywhere. */
static int _cbs_argc;
@@ -91,15 +97,18 @@ static char **_cbs_argv;
instead of taking a buffer size as an argument, it takes a count n of
elements, and a size m of each element. This allows it to properly check for
overflow, and errors if overflow would occur. */
-static void *bufalloc(void *, size_t n, size_t m);
+static void *bufalloc(void *_Nullable, size_t n, size_t m);
/* Error reporting functions. The die() function takes the same arguments as
printf() and prints the corresponding string to stderr. It also prefixes the
string with the command name followed by a colon, and suffixes the string
with a colon and the error string returned from strerror().
+ If you want to print just the error message and no custom text, NULL may be
+ passed to die(). NULL should not be passed to diex().
+
diex() is the same as die() but does not print a strerror() error string. */
-ATTR_FMT noreturn static void die(const char *, ...);
+ATTR_FMT noreturn static void die(const char *_Nullable, ...);
ATTR_FMT noreturn static void diex(const char *, ...);
/* Initializes some data required for this header to work properly. This should
@@ -259,7 +268,8 @@ static void tpwait(tpool_t *);
NULL, it will be ignored.
The free() function is a valid argument to the free parameter. */
-static void tpenq(tpool_t *, tfunc_t fn, void *arg, tfree_func_t free);
+static void tpenq(tpool_t *, tfunc_t fn, void *arg,
+ tfree_func_t _Nullable free);
static struct _tjob *_tpdeq(tpool_t *);
#endif /* CBS_PTHREAD */