iovec-util: add iovec_done_many_and_free()
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user