summaryrefslogtreecommitdiffstats
path: root/src/basic/iovec-util.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2023-11-21 14:16:44 +0100
committerLennart Poettering <lennart@poettering.net>2024-01-05 11:10:22 +0100
commitdddc12f9eb3ce924818e5dfcfe62ee5defb5bdb3 (patch)
treeca4917e8291450f4a3cfc54ba1b3bc0c41d816a8 /src/basic/iovec-util.h
parentiovec-util: add new iovec_memdup() helper (diff)
downloadsystemd-dddc12f9eb3ce924818e5dfcfe62ee5defb5bdb3.tar.xz
systemd-dddc12f9eb3ce924818e5dfcfe62ee5defb5bdb3.zip
iovec-util: add CONST_IOVEC_MAKE_STRING()
Diffstat (limited to '')
-rw-r--r--src/basic/iovec-util.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/basic/iovec-util.h b/src/basic/iovec-util.h
index abfa8c07da..bc7a67054a 100644
--- a/src/basic/iovec-util.h
+++ b/src/basic/iovec-util.h
@@ -29,6 +29,12 @@ static inline struct iovec* iovec_make_string(struct iovec *iovec, const char *s
#define IOVEC_MAKE_STRING(s) \
*iovec_make_string(&(struct iovec) {}, s)
+#define CONST_IOVEC_MAKE_STRING(s) \
+ (const struct iovec) { \
+ .iov_base = (char*) s, \
+ .iov_len = STRLEN(s), \
+ }
+
static inline void iovec_done(struct iovec *iovec) {
/* A _cleanup_() helper that frees the iov_base in the iovec */
assert(iovec);