io-util: introduce iovec_array_free()

It will be used in later commits.
This commit is contained in:
Lennart Poettering
2023-02-23 15:09:59 +09:00
committed by Yu Watanabe
parent dcef5e293f
commit 253a83ea44
2 changed files with 12 additions and 0 deletions
+10
View File
@@ -362,3 +362,13 @@ size_t iovw_size(struct iovec_wrapper *iovw) {
return n;
}
void iovec_array_free(struct iovec *iov, size_t n) {
if (!iov)
return;
for (size_t i = 0; i < n; i++)
free(iov[i].iov_base);
free(iov);
}
+2
View File
@@ -105,3 +105,5 @@ int iovw_put_string_field(struct iovec_wrapper *iovw, const char *field, const c
int iovw_put_string_field_free(struct iovec_wrapper *iovw, const char *field, char *value);
void iovw_rebase(struct iovec_wrapper *iovw, char *old, char *new);
size_t iovw_size(struct iovec_wrapper *iovw);
void iovec_array_free(struct iovec *iov, size_t n);