iovec-wrapper: reintroduce iovw_free() and iovw_free_free()

They were dropped by the commit 267b16f33c,
but will be used later. Hence, let's reintroduce them.
This commit is contained in:
Yu Watanabe
2026-04-24 03:10:16 +09:00
parent 32729ae92f
commit 4fc58bf621
2 changed files with 22 additions and 0 deletions

View File

@@ -24,6 +24,22 @@ void iovw_done_free(struct iovec_wrapper *iovw) {
iovw_done(iovw);
}
struct iovec_wrapper* iovw_free(struct iovec_wrapper *iovw) {
if (!iovw)
return NULL;
iovw_done(iovw);
return mfree(iovw);
}
struct iovec_wrapper* iovw_free_free(struct iovec_wrapper *iovw) {
if (!iovw)
return NULL;
iovw_done_free(iovw);
return mfree(iovw);
}
int iovw_compare(const struct iovec_wrapper *a, const struct iovec_wrapper *b) {
int r;

View File

@@ -11,6 +11,12 @@ struct iovec_wrapper {
void iovw_done_free(struct iovec_wrapper *iovw);
void iovw_done(struct iovec_wrapper *iovw);
struct iovec_wrapper* iovw_free(struct iovec_wrapper *iovw);
DEFINE_TRIVIAL_CLEANUP_FUNC(struct iovec_wrapper*, iovw_free);
struct iovec_wrapper* iovw_free_free(struct iovec_wrapper *iovw);
DEFINE_TRIVIAL_CLEANUP_FUNC(struct iovec_wrapper*, iovw_free_free);
int iovw_compare(const struct iovec_wrapper *a, const struct iovec_wrapper *b) _pure_;
static inline bool iovw_equal(const struct iovec_wrapper *a, const struct iovec_wrapper *b) {
return iovw_compare(a, b) == 0;