iovec-util: add iovec_done_many_and_free()

This commit is contained in:
Lennart Poettering
2025-12-21 07:04:42 +01:00
parent b6aa78f707
commit 7e3bdf90d9
+9
View File
@@ -31,6 +31,15 @@ static inline void iovec_done(struct iovec *iovec) {
iovec->iov_len = 0;
}
static inline void iovec_done_many_and_free(struct iovec *iovec, size_t n) {
if (n > 0) {
assert(iovec);
FOREACH_ARRAY(j, iovec, n)
iovec_done(j);
}
free(iovec);
}
static inline bool iovec_is_set(const struct iovec *iovec) {
/* Checks if the iovec points to a non-empty chunk of memory */
return iovec && iovec->iov_len > 0 && iovec->iov_base;