summaryrefslogtreecommitdiffstats
path: root/include/c/str/len/strnul.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/c/str/len/strnul.h')
-rw-r--r--include/c/str/len/strnul.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/include/c/str/len/strnul.h b/include/c/str/len/strnul.h
new file mode 100644
index 0000000..d15e44a
--- /dev/null
+++ b/include/c/str/len/strnul.h
@@ -0,0 +1,29 @@
+// Copyright 2023 Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: LGPL-3.0-or-later WITH LGPL-3.0-linking-exception
+
+
+#ifndef INCLUDE_C_STR_LEN_STRNUL_H_
+#define INCLUDE_C_STR_LEN_STRNUL_H_
+
+
+#include <string.h>
+
+#include <c/qual/const/const.h>
+
+
+#define c_strnul(str) c_const_generic_func(c_strnul, str)
+
+
+#pragma clang assume_nonnull begin
+inline const char *(c_strnul)(const char *s);
+
+
+inline const char *
+(c_strnul)(const char *s)
+{
+ return s + strlen(s);
+}
+#pragma clang assume_nonnull end
+
+
+#endif // Header guard