[Spice-devel] [spice-gtk] Use g_slist_foreach_full glib implementation

Christophe Fergeau cfergeau at redhat.com
Mon Aug 19 08:57:23 PDT 2013


For the compat case (glib < 2.28), we were using our own implementation
instead of directly reusing glib code.
---
 gtk/glib-compat.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/gtk/glib-compat.c b/gtk/glib-compat.c
index c3bb8e6..9ffadbb 100644
--- a/gtk/glib-compat.c
+++ b/gtk/glib-compat.c
@@ -81,18 +81,11 @@ g_simple_async_result_take_error (GSimpleAsyncResult *simple,
  * Since: 2.28
  **/
 G_GNUC_INTERNAL void
-g_slist_free_full(GSList         *list,
-                  GDestroyNotify free_func)
+g_slist_free_full (GSList         *list,
+		   GDestroyNotify  free_func)
 {
-    GSList *el;
-
-    if (free_func) {
-        for (el = list; el ; el = g_slist_next(el)) {
-            free_func(el->data);
-        }
-    }
-
-    g_slist_free(list);
+  g_slist_foreach (list, (GFunc) free_func, NULL);
+  g_slist_free (list);
 }
 
 #endif
-- 
1.8.3.1



More information about the Spice-devel mailing list