[gtk+] gdk/*: Use g_list_free_full convenience function



commit 24360a8076af35250d22bdf19b7d3f14c2e98833
Author: Javier JardÃn <jjardon gnome org>
Date:   Tue Jan 3 02:18:50 2012 +0100

    gdk/*: Use g_list_free_full convenience function

 gdk/broadway/gdkdisplay-broadway.c |    3 +--
 gdk/gdkdisplay.c                   |    6 ++----
 gdk/gdkwindow.c                    |   11 +++--------
 gdk/quartz/gdkdisplay-quartz.c     |    3 +--
 gdk/wayland/gdkdevice-wayland.c    |    3 +--
 gdk/wayland/gdkdisplay-wayland.c   |    3 +--
 gdk/x11/gdkdevicemanager-xi.c      |    4 ++--
 gdk/x11/gdkdisplay-x11.c           |    6 ++----
 8 files changed, 13 insertions(+), 26 deletions(-)
---
diff --git a/gdk/broadway/gdkdisplay-broadway.c b/gdk/broadway/gdkdisplay-broadway.c
index 5c711b7..4791168 100644
--- a/gdk/broadway/gdkdisplay-broadway.c
+++ b/gdk/broadway/gdkdisplay-broadway.c
@@ -1213,8 +1213,7 @@ gdk_broadway_display_finalize (GObject *object)
   _gdk_broadway_cursor_display_finalize (GDK_DISPLAY_OBJECT(broadway_display));
 
   /* input GdkDevice list */
-  g_list_foreach (broadway_display->input_devices, (GFunc) g_object_unref, NULL);
-  g_list_free (broadway_display->input_devices);
+  g_list_free_full (broadway_display->input_devices, g_object_unref);
   /* Free all GdkScreens */
   g_object_unref (broadway_display->screens[0]);
   g_free (broadway_display->screens);
diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c
index 5302ab8..702f6b4 100644
--- a/gdk/gdkdisplay.c
+++ b/gdk/gdkdisplay.c
@@ -154,8 +154,7 @@ free_device_grabs_foreach (gpointer key,
 {
   GList *list = value;
 
-  g_list_foreach (list, (GFunc) free_device_grab, NULL);
-  g_list_free (list);
+  g_list_free_full (list, (GDestroyNotify) free_device_grab);
 
   return TRUE;
 }
@@ -211,8 +210,7 @@ gdk_display_dispose (GObject *object)
 
   device_manager = gdk_display_get_device_manager (GDK_DISPLAY (object));
 
-  g_list_foreach (display->queued_events, (GFunc)gdk_event_free, NULL);
-  g_list_free (display->queued_events);
+  g_list_free_full (display->queued_events, (GDestroyNotify) gdk_event_free);
   display->queued_events = NULL;
   display->queued_tail = NULL;
 
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index a6170a9..0b9eacc 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -2065,12 +2065,8 @@ _gdk_window_destroy_hierarchy (GdkWindow *window,
 	      window->clip_region_with_children = NULL;
 	    }
 
-	  if (window->outstanding_moves)
-	    {
-	      g_list_foreach (window->outstanding_moves, (GFunc)gdk_window_region_move_free, NULL);
-	      g_list_free (window->outstanding_moves);
-	      window->outstanding_moves = NULL;
-	    }
+	  g_list_free_full (window->outstanding_moves, (GDestroyNotify) gdk_window_region_move_free);
+	  window->outstanding_moves = NULL;
 	}
       break;
     }
@@ -3945,8 +3941,7 @@ _gdk_window_process_updates_recurse (GdkWindow *window,
 	}
     }
 
-  g_list_foreach (children, (GFunc)g_object_unref, NULL);
-  g_list_free (children);
+  g_list_free_full (children, g_object_unref);
 
 }
 
diff --git a/gdk/quartz/gdkdisplay-quartz.c b/gdk/quartz/gdkdisplay-quartz.c
index 4773932..53121f5 100644
--- a/gdk/quartz/gdkdisplay-quartz.c
+++ b/gdk/quartz/gdkdisplay-quartz.c
@@ -308,8 +308,7 @@ gdk_quartz_display_finalize (GObject *object)
 {
   GdkQuartzDisplay *display_quartz = GDK_QUARTZ_DISPLAY (object);
 
-  g_list_foreach (display_quartz->input_devices, (GFunc) g_object_unref, NULL);
-  g_list_free (display_quartz->input_devices);
+  g_list_free_full (display_quartz->input_devices, g_object_unref);
 
   G_OBJECT_CLASS (gdk_quartz_display_parent_class)->finalize (object);
 }
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index ace1bb1..5ef8510 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -823,8 +823,7 @@ gdk_device_manager_core_finalize (GObject *object)
 
   device_manager_core = GDK_DEVICE_MANAGER_CORE (object);
 
-  g_list_foreach (device_manager_core->devices, free_device, NULL);
-  g_list_free (device_manager_core->devices);
+  g_list_free_full (device_manager_core->devices, free_device);
 
   G_OBJECT_CLASS (gdk_device_manager_core_parent_class)->finalize (object);
 }
diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c
index 47b8cac..a6442d7 100644
--- a/gdk/wayland/gdkdisplay-wayland.c
+++ b/gdk/wayland/gdkdisplay-wayland.c
@@ -274,8 +274,7 @@ gdk_wayland_display_finalize (GObject *object)
     g_object_unref (display_wayland->keymap);
 
   /* input GdkDevice list */
-  g_list_foreach (display_wayland->input_devices, (GFunc) g_object_unref, NULL);
-  g_list_free (display_wayland->input_devices);
+  g_list_free_full (display_wayland->input_devices, g_object_unref);
 
   g_object_unref (display_wayland->screen);
 
diff --git a/gdk/x11/gdkdevicemanager-xi.c b/gdk/x11/gdkdevicemanager-xi.c
index a0ba467..5cb4705 100644
--- a/gdk/x11/gdkdevicemanager-xi.c
+++ b/gdk/x11/gdkdevicemanager-xi.c
@@ -308,8 +308,8 @@ gdk_x11_device_manager_xi_dispose (GObject *object)
   GdkX11DeviceManagerXI *device_manager;
 
   device_manager = GDK_X11_DEVICE_MANAGER_XI (object);
-  g_list_foreach (device_manager->devices, (GFunc) g_object_unref, NULL);
-  g_list_free (device_manager->devices);
+
+  g_list_free_full (device_manager->devices, g_object_unref);
   device_manager->devices = NULL;
 
   if (device_manager->id_table != NULL)
diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
index 49ddb6b..6a32285 100644
--- a/gdk/x11/gdkdisplay-x11.c
+++ b/gdk/x11/gdkdisplay-x11.c
@@ -1767,12 +1767,10 @@ gdk_x11_display_finalize (GObject *object)
   g_slist_free (display_x11->event_types);
 
   /* input GdkDevice list */
-  g_list_foreach (display_x11->input_devices, (GFunc) g_object_unref, NULL);
-  g_list_free (display_x11->input_devices);
+  g_list_free_full (display_x11->input_devices, g_object_unref);
 
   /* input GdkWindow list */
-  g_list_foreach (display_x11->input_windows, (GFunc) g_free, NULL);
-  g_list_free (display_x11->input_windows);
+  g_list_free_full (display_x11->input_windows, g_free);
 
   /* Free all GdkScreens */
   for (i = 0; i < ScreenCount (display_x11->xdisplay); i++)



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