[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULLv2 02/25] glib-compat: add g_(s)list_free_full()
From: |
Marc-André Lureau |
Subject: |
[Qemu-devel] [PULLv2 02/25] glib-compat: add g_(s)list_free_full() |
Date: |
Thu, 8 Sep 2016 18:16:57 +0400 |
Those functions are only available since glib 2.28.
Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
---
include/glib-compat.h | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/include/glib-compat.h b/include/glib-compat.h
index 8d5a7f3..8093163 100644
--- a/include/glib-compat.h
+++ b/include/glib-compat.h
@@ -280,4 +280,28 @@ static inline void g_hash_table_add(GHashTable
*hash_table, gpointer key)
} while (0)
#endif
+#if !GLIB_CHECK_VERSION(2, 28, 0)
+static inline void g_list_free_full(GList *list, GDestroyNotify free_func)
+{
+ GList *l;
+
+ for (l = list; l; l = l->next) {
+ free_func(l->data);
+ }
+
+ g_list_free(list);
+}
+
+static inline void g_slist_free_full(GSList *list, GDestroyNotify free_func)
+{
+ GSList *l;
+
+ for (l = list; l; l = l->next) {
+ free_func(l->data);
+ }
+
+ g_slist_free(list);
+}
+#endif
+
#endif
--
2.10.0
- [Qemu-devel] [PULLv2 00/25] Leak patches, Marc-André Lureau, 2016/09/08
- [Qemu-devel] [PULLv2 01/25] tests: fix test-qga leaks, Marc-André Lureau, 2016/09/08
- [Qemu-devel] [PULLv2 02/25] glib-compat: add g_(s)list_free_full(),
Marc-André Lureau <=
- [Qemu-devel] [PULLv2 04/25] qga: free remaining leaking state, Marc-André Lureau, 2016/09/08
- [Qemu-devel] [PULLv2 03/25] qga: free the whole blacklist, Marc-André Lureau, 2016/09/08
- [Qemu-devel] [PULLv2 05/25] tests: fix test-cutils leaks, Marc-André Lureau, 2016/09/08
- [Qemu-devel] [PULLv2 07/25] tests: fix test-iov leaks, Marc-André Lureau, 2016/09/08
- [Qemu-devel] [PULLv2 08/25] tests: fix check-qom-interface leaks, Marc-André Lureau, 2016/09/08
- [Qemu-devel] [PULLv2 06/25] tests: fix test-vmstate leaks, Marc-André Lureau, 2016/09/08
- [Qemu-devel] [PULLv2 10/25] tests: fix leak in test-string-input-visitor, Marc-André Lureau, 2016/09/08
- [Qemu-devel] [PULLv2 09/25] tests: fix check-qom-proplist leaks, Marc-André Lureau, 2016/09/08
- [Qemu-devel] [PULLv2 11/25] portio: keep references on portio, Marc-André Lureau, 2016/09/08
- [Qemu-devel] [PULLv2 12/25] pc: simplify passing qemu_irq, Marc-André Lureau, 2016/09/08