[spice-gtk 1/2] Add compat implementation of g_queue_free_full()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This was introduced in glib 2.32 and the webdav channel uses it.
---
 gtk/glib-compat.c | 22 ++++++++++++++++++++++
 gtk/glib-compat.h |  3 +++
 2 files changed, 25 insertions(+)

diff --git a/gtk/glib-compat.c b/gtk/glib-compat.c
index f940e0a..9d1165e 100644
--- a/gtk/glib-compat.c
+++ b/gtk/glib-compat.c
@@ -100,6 +100,28 @@ g_slist_free_full (GSList         *list,
 G_DEFINE_BOXED_TYPE (GMainContext, spice_main_context, g_main_context_ref, g_main_context_unref)
 #endif
 
+
+#if !GLIB_CHECK_VERSION(2,32,0)
+/**
+ * g_queue_free_full:
+ * @queue: a pointer to a #GQueue
+ * @free_func: the function to be called to free each element's data
+ *
+ * Convenience method, which frees all the memory used by a #GQueue,
+ * and calls the specified destroy function on every element's data.
+ *
+ * Since: 2.32
+ */
+void
+g_queue_free_full (GQueue        *queue,
+                  GDestroyNotify  free_func)
+{
+  g_queue_foreach (queue, (GFunc) free_func, NULL);
+  g_queue_free (queue);
+}
+#endif
+
+
 #if !GLIB_CHECK_VERSION(2,27,2)
 guint64 g_get_monotonic_time(void)
 {
diff --git a/gtk/glib-compat.h b/gtk/glib-compat.h
index 4acf401..45d961e 100644
--- a/gtk/glib-compat.h
+++ b/gtk/glib-compat.h
@@ -112,6 +112,9 @@ GType spice_main_context_get_type (void) G_GNUC_CONST;
 
 #if !GLIB_CHECK_VERSION(2,32,0)
 # define G_SIGNAL_DEPRECATED (1 << 9)
+void
+g_queue_free_full (GQueue        *queue,
+                   GDestroyNotify  free_func);
 #endif
 
 #ifndef g_clear_pointer
-- 
1.9.0

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]