summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrbuj <[email protected]>2019-03-02 18:20:30 +0100
committerZenWalker <[email protected]>2019-03-28 14:21:01 +0100
commitb0df98a1c2745b20325ae1d70413601dda9b46dd (patch)
tree5548e03f391640d87eba01ff61e73e4554497a05
parent83a915dc851f7d3385e0d38f57cc249e038dcd1d (diff)
downloadmarco-b0df98a1c2745b20325ae1d70413601dda9b46dd.tar.bz2
marco-b0df98a1c2745b20325ae1d70413601dda9b46dd.tar.xz
Fix -Werror=cast-function-type
Bump glib-2 required version to 2.58: G_SOURCE_FUNC https://gitlab.gnome.org/GNOME/glib/commit/039fa6897bb4c5cd30caec8ee3add1a4ef612f76 Build & install:i export CC=gcci export CFLAGS=-Werror=cast-function-type ./autogen.sh --prefix=/usr make clean make sudo make install
-rw-r--r--configure.ac2
-rw-r--r--src/core/boxes.c5
-rw-r--r--src/core/edge-resistance.c8
-rw-r--r--src/core/eventqueue.c5
-rw-r--r--src/core/main.c6
-rw-r--r--src/core/screen.c11
-rw-r--r--src/core/util.c5
-rw-r--r--src/ui/menu.c19
-rw-r--r--src/ui/tabpopup.c12
-rw-r--r--src/wm-tester/main.c3
10 files changed, 41 insertions, 35 deletions
diff --git a/configure.ac b/configure.ac
index 106bc60f..fc1a6288 100644
--- a/configure.ac
+++ b/configure.ac
@@ -155,7 +155,7 @@ AC_CHECK_HEADERS(execinfo.h, [AC_CHECK_FUNCS(backtrace)])
AM_GLIB_GNU_GETTEXT
-PKG_CHECK_MODULES(ALL, glib-2.0 >= 2.50.0)
+PKG_CHECK_MODULES(ALL, glib-2.0 >= 2.58.0)
PKG_CHECK_MODULES(MARCO_MESSAGE, gtk+-3.0 >= $GTK_MIN_VERSION)
PKG_CHECK_MODULES(MARCO_WINDOW_DEMO, gtk+-3.0 >= $GTK_MIN_VERSION)
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
diff --git a/src/ui/menu.c b/src/ui/menu.c
index aeba64fa..90db5f1e 100644
--- a/src/ui/menu.c
+++ b/src/ui/menu.c
@@ -100,6 +100,21 @@ static MenuItem menuitems[] = {
{META_MENU_OP_DELETE, MENU_ITEM_IMAGE, MARCO_STOCK_DELETE, FALSE, N_("_Close")}
};
+static void
+sn_menu_data_free (MenuData *menu_data,
+ GClosure *closure)
+{
+ g_free (menu_data->menu);
+ g_free (menu_data);
+}
+
+static void
+sn_menu_item_free (MenuItem *menu_item,
+ GClosure *closure)
+{
+ g_free (menu_item);
+}
+
static void popup_position_func(GtkMenu* menu, gint* x, gint* y, gboolean* push_in, gpointer user_data)
{
GtkRequisition req;
@@ -442,7 +457,7 @@ meta_window_menu_new (MetaFrames *frames,
"activate",
G_CALLBACK (activate_cb),
md,
- (GClosureNotify) g_free, 0);
+ (GClosureNotify) sn_menu_data_free, 0);
gtk_menu_shell_append (GTK_MENU_SHELL (submenu), submi);
@@ -469,7 +484,7 @@ meta_window_menu_new (MetaFrames *frames,
"activate",
G_CALLBACK (activate_cb),
md,
- (GClosureNotify) g_free, 0);
+ (GClosureNotify) sn_menu_item_free, 0);
}
if (mi)
diff --git a/src/ui/tabpopup.c b/src/ui/tabpopup.c
index 37231a5b..10c7898f 100644
--- a/src/ui/tabpopup.c
+++ b/src/ui/tabpopup.c
@@ -636,7 +636,9 @@ unselect_image (GtkWidget *widget)
gtk_widget_queue_draw (widget);
}
-static void meta_select_image_class_init (MetaSelectImageClass *klass);
+static void meta_select_image_class_init (MetaSelectImageClass *klass,
+ void *data);
+
static gboolean meta_select_image_draw (GtkWidget *widget,
cairo_t *cr);
@@ -669,7 +671,7 @@ meta_select_image_get_type (void)
}
static void
-meta_select_image_class_init (MetaSelectImageClass *klass)
+meta_select_image_class_init (MetaSelectImageClass *klass, void *data)
{
GtkWidgetClass *widget_class;
@@ -805,7 +807,8 @@ unselect_workspace (GtkWidget *widget)
gtk_widget_queue_draw (widget);
}
-static void meta_select_workspace_class_init (MetaSelectWorkspaceClass *klass);
+static void meta_select_workspace_class_init (MetaSelectWorkspaceClass *klass,
+ void *data);
static gboolean meta_select_workspace_draw (GtkWidget *widget,
cairo_t *cr);
@@ -840,7 +843,8 @@ meta_select_workspace_get_type (void)
}
static void
-meta_select_workspace_class_init (MetaSelectWorkspaceClass *klass)
+meta_select_workspace_class_init (MetaSelectWorkspaceClass *klass,
+ void *data)
{
GtkWidgetClass *widget_class;
diff --git a/src/wm-tester/main.c b/src/wm-tester/main.c
index 1581f666..d45b09f7 100644
--- a/src/wm-tester/main.c
+++ b/src/wm-tester/main.c
@@ -230,8 +230,7 @@ set_up_icon_windows (void)
gtk_window_set_icon_list (GTK_WINDOW (w), icons);
- g_list_foreach (icons, (GFunc) g_object_unref, NULL);
- g_list_free (icons);
+ g_list_free_full (icons, g_object_unref);
gtk_widget_show_all (w);