]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
iovec-util: add helper for a single NUL byte iovec
authorLennart Poettering <lennart@poettering.net>
Fri, 5 Jan 2024 15:32:43 +0000 (16:32 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 11 Jan 2024 15:05:20 +0000 (16:05 +0100)
src/basic/iovec-util.h

index bc7a67054adae996a3a17bbad483f3bd3c53f199..8cfa5717dc48c461272946e0a7643898fecfd1a1 100644 (file)
@@ -8,6 +8,12 @@
 #include "alloc-util.h"
 #include "macro.h"
 
+/* An iovec pointing to a single NUL byte */
+#define IOVEC_NUL_BYTE (const struct iovec) {                   \
+                .iov_base = (void*) (const uint8_t[1]) { 0 },   \
+                .iov_len = 1,                                   \
+        }
+
 size_t iovec_total_size(const struct iovec *iovec, size_t n);
 
 bool iovec_increment(struct iovec *iovec, size_t n, size_t k);