diff options
author | Lennart Poettering <lennart@poettering.net> | 2023-11-21 14:16:44 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2024-01-05 11:10:22 +0100 |
commit | dddc12f9eb3ce924818e5dfcfe62ee5defb5bdb3 (patch) | |
tree | ca4917e8291450f4a3cfc54ba1b3bc0c41d816a8 /src/basic/iovec-util.h | |
parent | iovec-util: add new iovec_memdup() helper (diff) | |
download | systemd-dddc12f9eb3ce924818e5dfcfe62ee5defb5bdb3.tar.xz systemd-dddc12f9eb3ce924818e5dfcfe62ee5defb5bdb3.zip |
iovec-util: add CONST_IOVEC_MAKE_STRING()
Diffstat (limited to '')
-rw-r--r-- | src/basic/iovec-util.h | 6 |
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); |