diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/boxes.c | 5 | ||||
-rw-r--r-- | src/core/edge-resistance.c | 8 | ||||
-rw-r--r-- | src/core/eventqueue.c | 5 | ||||
-rw-r--r-- | src/core/main.c | 6 | ||||
-rw-r--r-- | src/core/screen.c | 11 | ||||
-rw-r--r-- | src/core/util.c | 5 |
6 files changed, 14 insertions, 26 deletions
diff --git a/src/core/boxes.c b/src/core/boxes.c index c36abfcd..c9ce916a 100644 --- a/src/core/boxes.c +++ b/src/core/boxes.c @@ -767,10 +767,7 @@ meta_rectangle_expand_to_avoiding_struts (MetaRectangle *rect, void meta_rectangle_free_list_and_elements (GList *filled_list) { - g_list_foreach (filled_list, - (void (*)(gpointer,gpointer))&g_free, /* ew, for ugly */ - NULL); - g_list_free (filled_list); + g_list_free_full (filled_list, g_free); } gboolean diff --git a/src/core/edge-resistance.c b/src/core/edge-resistance.c index 8a0d1854..d8a643a6 100644 --- a/src/core/edge-resistance.c +++ b/src/core/edge-resistance.c @@ -1105,13 +1105,7 @@ compute_resistance_and_snapping_edges (MetaDisplay *display) g_list_free (stacked_windows); /* Free the memory used by the obscuring windows/docks lists */ g_slist_free (window_stacking); - /* FIXME: Shouldn't there be a helper function to make this one line of code - * to free a list instead of four ugly ones? - */ - g_slist_foreach (obscuring_windows, - (void (*)(gpointer,gpointer))&g_free, /* ew, for ugly */ - NULL); - g_slist_free (obscuring_windows); + g_slist_free_full (obscuring_windows, g_free); /* Sort the list. FIXME: Should I bother with this sorting? I just * sort again later in cache_edges() anyway... diff --git a/src/core/eventqueue.c b/src/core/eventqueue.c index 290f9543..c85fdc51 100644 --- a/src/core/eventqueue.c +++ b/src/core/eventqueue.c @@ -22,6 +22,7 @@ * 02110-1301, USA. */ #include "eventqueue.h" +#include <glib-object.h> #include <X11/Xlib.h> static gboolean eq_prepare (GSource *source, @@ -70,7 +71,7 @@ meta_event_queue_new (Display *display, MetaEventQueueFunc func, gpointer data) g_source_add_poll (source, &eq->poll_fd); g_source_set_can_recurse (source, TRUE); - g_source_set_callback (source, (GSourceFunc) func, data, NULL); + g_source_set_callback (source, G_SOURCE_FUNC (func), data, NULL); g_source_attach (source, NULL); g_source_unref (source); @@ -152,7 +153,7 @@ eq_dispatch (GSource *source, GSourceFunc callback, gpointer user_data) MetaEventQueueFunc func; event = g_queue_pop_head (eq->events); - func = (MetaEventQueueFunc) callback; + func = (MetaEventQueueFunc) G_CALLBACK (callback); (* func) (event, user_data); diff --git a/src/core/main.c b/src/core/main.c index 31958d22..6f6170d6 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -385,7 +385,9 @@ sigterm_handler (int signum) } static gboolean -on_sigterm (void) +on_sigterm (GIOChannel *source, + GIOCondition condition, + gpointer user_data) { meta_quit (META_EXIT_SUCCESS); return FALSE; @@ -437,7 +439,7 @@ main (int argc, char **argv) channel = g_io_channel_unix_new (sigterm_pipe_fds[0]); g_io_channel_set_flags (channel, G_IO_FLAG_NONBLOCK, NULL); - g_io_add_watch (channel, G_IO_IN, (GIOFunc) on_sigterm, NULL); + g_io_add_watch (channel, G_IO_IN, on_sigterm, NULL); g_io_channel_set_close_on_unref (channel, TRUE); g_io_channel_unref (channel); diff --git a/src/core/screen.c b/src/core/screen.c index 0b79c460..e14f8d52 100644 --- a/src/core/screen.c +++ b/src/core/screen.c @@ -648,9 +648,8 @@ meta_screen_free (MetaScreen *screen, meta_screen_ungrab_keys (screen); #ifdef HAVE_STARTUP_NOTIFICATION - g_slist_foreach (screen->startup_sequences, - (GFunc) sn_startup_sequence_unref, NULL); - g_slist_free (screen->startup_sequences); + g_slist_free_full (screen->startup_sequences, + (GDestroyNotify) sn_startup_sequence_unref); screen->startup_sequences = NULL; if (screen->startup_sequence_timeout != 0) @@ -797,8 +796,7 @@ meta_screen_manage_all_windows (MetaScreen *screen) } meta_stack_thaw (screen->stack); - g_list_foreach (windows, (GFunc)g_free, NULL); - g_list_free (windows); + g_list_free_full (windows, g_free); meta_display_ungrab (screen->display); } @@ -838,8 +836,7 @@ meta_screen_composite_all_windows (MetaScreen *screen) meta_stack_thaw (screen->stack); - g_list_foreach (windows, (GFunc)g_free, NULL); - g_list_free (windows); + g_list_free_full (windows, g_free); #endif } diff --git a/src/core/util.c b/src/core/util.c index a30707a7..7b5f0803 100644 --- a/src/core/util.c +++ b/src/core/util.c @@ -207,10 +207,7 @@ utf8_fputs (const char *str, void meta_free_gslist_and_elements (GSList *list_to_deep_free) { - g_slist_foreach (list_to_deep_free, - (void (*)(gpointer,gpointer))&g_free, /* ew, for ugly */ - NULL); - g_slist_free (list_to_deep_free); + g_slist_free_full (list_to_deep_free, g_free); } #ifdef WITH_VERBOSE_MODE |