iovec-util: add CONST_IOVEC_MAKE_STRING()

This commit is contained in:
Lennart Poettering
2024-01-05 11:10:22 +01:00
parent 4cc467b67c
commit dddc12f9eb
+6
View File
@@ -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);