From 045f7b8fe40f3ddd338c3c870885882e0175e99f Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 5 Jan 2024 16:32:43 +0100 Subject: [PATCH] iovec-util: add helper for a single NUL byte iovec --- src/basic/iovec-util.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/basic/iovec-util.h b/src/basic/iovec-util.h index bc7a67054ad..8cfa5717dc4 100644 --- a/src/basic/iovec-util.h +++ b/src/basic/iovec-util.h @@ -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); -- 2.47.3