]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
iovec-wrapper: reintroduce iovw_free() and iovw_free_free()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 23 Apr 2026 18:10:16 +0000 (03:10 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 12 May 2026 06:33:21 +0000 (15:33 +0900)
They were dropped by the commit 267b16f33c5636617927f15d7ae6b945c862a587,
but will be used later. Hence, let's reintroduce them.

src/basic/iovec-wrapper.c
src/basic/iovec-wrapper.h

index 6b4b006c059dceb5cbc8c1b62c34587006d54bfa..da217170c573c8b83f4259b83004ad40245ab69f 100644 (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;
 
index c2a0cff1aeed69194c4ab29bd85e3937ab9d5b39..a4f93f1fdb94b4c3666cff68f2299873ac42d164 100644 (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;