From 28a6895df5fa4a1a60c794ed5e85e31d764e85e7 Mon Sep 17 00:00:00 2001 From: rbuj Date: Fri, 28 Feb 2020 09:07:37 +0100 Subject: Remove warnings: cast between incompatible function types --- plugins/filebrowser/pluma-file-bookmarks-store.c | 9 +++------ plugins/filebrowser/pluma-file-browser-messages.c | 3 ++- plugins/filebrowser/pluma-file-browser-store.c | 6 ++---- plugins/filebrowser/pluma-file-browser-view.c | 3 +-- plugins/filebrowser/pluma-file-browser-widget.c | 18 ++++++------------ plugins/spell/pluma-spell-checker-dialog.c | 6 ++---- pluma/pluma-commands-file.c | 6 ++---- pluma/pluma-history-entry.c | 6 ++---- pluma/pluma-message-bus.c | 14 +++----------- pluma/pluma-prefs-manager.c | 6 ++---- pluma/pluma-utils.c | 3 +-- pluma/pluma-window.c | 3 +-- pluma/pluma.c | 3 +-- 13 files changed, 28 insertions(+), 58 deletions(-) diff --git a/plugins/filebrowser/pluma-file-bookmarks-store.c b/plugins/filebrowser/pluma-file-bookmarks-store.c index 4493742c..c8da938e 100644 --- a/plugins/filebrowser/pluma-file-bookmarks-store.c +++ b/plugins/filebrowser/pluma-file-bookmarks-store.c @@ -370,8 +370,7 @@ init_drives (PlumaFileBookmarksStore *model) drives = g_volume_monitor_get_connected_drives (model->priv->volume_monitor); g_list_foreach (drives, (GFunc)process_drive_cb, model); - g_list_foreach (drives, (GFunc)g_object_unref, NULL); - g_list_free (drives); + g_list_free_full (drives, g_object_unref); } static void @@ -399,8 +398,7 @@ init_volumes (PlumaFileBookmarksStore *model) volumes = g_volume_monitor_get_volumes (model->priv->volume_monitor); g_list_foreach (volumes, (GFunc)process_volume_nodrive_cb, model); - g_list_foreach (volumes, (GFunc)g_object_unref, NULL); - g_list_free (volumes); + g_list_free_full (volumes, g_object_unref); } static void @@ -430,8 +428,7 @@ init_mounts (PlumaFileBookmarksStore *model) mounts = g_volume_monitor_get_mounts (model->priv->volume_monitor); g_list_foreach (mounts, (GFunc)process_mount_novolume_cb, model); - g_list_foreach (mounts, (GFunc)g_object_unref, NULL); - g_list_free (mounts); + g_list_free_full (mounts, g_object_unref); } static void diff --git a/plugins/filebrowser/pluma-file-browser-messages.c b/plugins/filebrowser/pluma-file-browser-messages.c index 2c703973..2aa27418 100644 --- a/plugins/filebrowser/pluma-file-browser-messages.c +++ b/plugins/filebrowser/pluma-file-browser-messages.c @@ -154,7 +154,8 @@ track_row_lookup (WindowData *data, } static void -message_cache_data_free (MessageCacheData *data) +message_cache_data_free (MessageCacheData *data, + GClosure *closure) { g_object_unref (data->message); g_slice_free (MessageCacheData, data); diff --git a/plugins/filebrowser/pluma-file-browser-store.c b/plugins/filebrowser/pluma-file-browser-store.c index 03fd1fd2..ae100379 100644 --- a/plugins/filebrowser/pluma-file-browser-store.c +++ b/plugins/filebrowser/pluma-file-browser-store.c @@ -3253,8 +3253,7 @@ async_data_free (AsyncData * data) { g_object_unref (data->cancellable); - g_list_foreach (data->files, (GFunc)g_object_unref, NULL); - g_list_free (data->files); + g_list_free_full (data->files, g_object_unref); if (!data->removed) data->model->priv->async_handles = g_slist_remove (data->model->priv->async_handles, data); @@ -3444,8 +3443,7 @@ pluma_file_browser_store_delete (PlumaFileBrowserStore * model, rows = g_list_append(NULL, pluma_file_browser_store_get_path_real (model, node)); result = pluma_file_browser_store_delete_all (model, rows, trash); - g_list_foreach (rows, (GFunc)gtk_tree_path_free, NULL); - g_list_free (rows); + g_list_free_full (rows, (GDestroyNotify) gtk_tree_path_free); return result; } diff --git a/plugins/filebrowser/pluma-file-browser-view.c b/plugins/filebrowser/pluma-file-browser-view.c index 496d5626..5fae1745 100644 --- a/plugins/filebrowser/pluma-file-browser-view.c +++ b/plugins/filebrowser/pluma-file-browser-view.c @@ -379,8 +379,7 @@ activate_selected_files (PlumaFileBrowserView *view) { g_signal_emit (view, signals[DIRECTORY_ACTIVATED], 0, &iter); } - g_list_foreach (rows, (GFunc)gtk_tree_path_free, NULL); - g_list_free (rows); + g_list_free_full (rows, (GDestroyNotify) gtk_tree_path_free); } static void diff --git a/plugins/filebrowser/pluma-file-browser-widget.c b/plugins/filebrowser/pluma-file-browser-widget.c index 25ec921a..58afc036 100644 --- a/plugins/filebrowser/pluma-file-browser-widget.c +++ b/plugins/filebrowser/pluma-file-browser-widget.c @@ -343,8 +343,7 @@ pluma_file_browser_widget_finalize (GObject * object) g_object_unref (obj->priv->bookmarks_store); g_object_unref (obj->priv->combo_model); - g_slist_foreach (obj->priv->filter_funcs, (GFunc) g_free, NULL); - g_slist_free (obj->priv->filter_funcs); + g_slist_free_full (obj->priv->filter_funcs, g_free); for (loc = obj->priv->locations; loc; loc = loc->next) location_free ((Location *) (loc->data)); @@ -1334,8 +1333,7 @@ pluma_file_browser_widget_get_first_selected (PlumaFileBrowserWidget *obj, result = gtk_tree_model_get_iter(model, iter, (GtkTreePath *)(rows->data)); - g_list_foreach (rows, (GFunc)gtk_tree_path_free, NULL); - g_list_free (rows); + g_list_free_full (rows, (GDestroyNotify) gtk_tree_path_free); return result; } @@ -1457,8 +1455,7 @@ get_deletable_files (PlumaFileBrowserWidget *obj) { paths = g_list_append (paths, gtk_tree_path_copy (path)); } - g_list_foreach (rows, (GFunc)gtk_tree_path_free, NULL); - g_list_free (rows); + g_list_free_full (rows, (GDestroyNotify) gtk_tree_path_free); return paths; } @@ -1491,8 +1488,7 @@ delete_selected_files (PlumaFileBrowserWidget * obj, gboolean trash) result = pluma_file_browser_store_delete_all (PLUMA_FILE_BROWSER_STORE (model), rows, trash); - g_list_foreach (rows, (GFunc)gtk_tree_path_free, NULL); - g_list_free (rows); + g_list_free_full (rows, (GDestroyNotify) gtk_tree_path_free); return result == PLUMA_FILE_BROWSER_STORE_RESULT_OK; } @@ -2055,8 +2051,7 @@ pluma_file_browser_widget_get_num_selected_files_or_directories (PlumaFileBrowse } } - g_list_foreach (rows, (GFunc)gtk_tree_path_free, NULL); - g_list_free (rows); + g_list_free_full (rows, (GDestroyNotify) gtk_tree_path_free); return result; } @@ -2179,8 +2174,7 @@ try_activate_drive (PlumaFileBrowserWidget *widget, try_mount_volume (widget, volume); } - g_list_foreach (volumes, (GFunc)g_object_unref, NULL); - g_list_free (volumes); + g_list_free_full (volumes, g_object_unref); } static void diff --git a/plugins/spell/pluma-spell-checker-dialog.c b/plugins/spell/pluma-spell-checker-dialog.c index 3689a280..146c3175 100644 --- a/plugins/spell/pluma-spell-checker-dialog.c +++ b/plugins/spell/pluma-spell-checker-dialog.c @@ -426,8 +426,7 @@ pluma_spell_checker_dialog_set_misspelled_word (PlumaSpellCheckerDialog *dlg, update_suggestions_list_model (dlg, sug); /* free the suggestion list */ - g_slist_foreach (sug, (GFunc)g_free, NULL); - g_slist_free (sug); + g_slist_free_full (sug, g_free); gtk_widget_set_sensitive (dlg->ignore_button, TRUE); gtk_widget_set_sensitive (dlg->ignore_all_button, TRUE); @@ -578,8 +577,7 @@ check_word_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *d update_suggestions_list_model (dlg, sug); /* free the suggestion list */ - g_slist_foreach (sug, (GFunc)g_free, NULL); - g_slist_free (sug); + g_slist_free_full (sug, g_free); } } diff --git a/pluma/pluma-commands-file.c b/pluma/pluma-commands-file.c index 689398a6..2d7e9f31 100644 --- a/pluma/pluma-commands-file.c +++ b/pluma/pluma-commands-file.c @@ -296,8 +296,7 @@ load_uri_list (PlumaWindow *window, ret = load_file_list (window, files, encoding, line_pos, create); - g_slist_foreach (files, (GFunc) g_object_unref, NULL); - g_slist_free (files); + g_slist_free_full (files, g_object_unref); return ret; } @@ -433,8 +432,7 @@ open_dialog_response_cb (PlumaFileChooserDialog *dialog, encoding, 0); - g_slist_foreach (files, (GFunc) g_object_unref, NULL); - g_slist_free (files); + g_slist_free_full (files, g_object_unref); } void diff --git a/pluma/pluma-history-entry.c b/pluma/pluma-history-entry.c index 13c853e4..3dacc123 100644 --- a/pluma/pluma-history-entry.c +++ b/pluma/pluma-history-entry.c @@ -226,8 +226,7 @@ pluma_history_entry_save_history (PlumaHistoryEntry *entry) entry->priv->history_id, settings_items); - g_slist_foreach (settings_items, (GFunc) g_free, NULL); - g_slist_free (settings_items); + g_slist_free_full (settings_items, g_free); } static gboolean @@ -373,8 +372,7 @@ pluma_history_entry_load_history (PlumaHistoryEntry *entry) -1); } - g_slist_foreach (settings_items, (GFunc) g_free, NULL); - g_slist_free (settings_items); + g_slist_free_full (settings_items, g_free); } void diff --git a/pluma/pluma-message-bus.c b/pluma/pluma-message-bus.c index 621a1d03..fc10a9d5 100644 --- a/pluma/pluma-message-bus.c +++ b/pluma/pluma-message-bus.c @@ -158,19 +158,11 @@ message_free (Message *message) g_free (message->method); g_free (message->object_path); - g_list_foreach (message->listeners, (GFunc)listener_free, NULL); - g_list_free (message->listeners); + g_list_free_full (message->listeners, (GDestroyNotify) listener_free); g_free (message); } -static void -message_queue_free (GList *queue) -{ - g_list_foreach (queue, (GFunc)g_object_unref, NULL); - g_list_free (queue); -} - static void pluma_message_bus_finalize (GObject *object) { @@ -179,7 +171,7 @@ pluma_message_bus_finalize (GObject *object) if (bus->priv->idle_id != 0) g_source_remove (bus->priv->idle_id); - message_queue_free (bus->priv->message_queue); + g_list_free_full (bus->priv->message_queue, g_object_unref); g_hash_table_destroy (bus->priv->messages); g_hash_table_destroy (bus->priv->idmap); @@ -432,7 +424,7 @@ idle_dispatch (PlumaMessageBus *bus) dispatch_message (bus, msg); } - message_queue_free (list); + g_list_free_full (list, g_object_unref); return FALSE; } diff --git a/pluma/pluma-prefs-manager.c b/pluma/pluma-prefs-manager.c index 2bbfbfa2..f150d13b 100644 --- a/pluma/pluma-prefs-manager.c +++ b/pluma/pluma-prefs-manager.c @@ -703,8 +703,7 @@ pluma_prefs_manager_get_auto_detected_encodings (void) tmp = g_slist_next (tmp); } - g_slist_foreach (strings, (GFunc) g_free, NULL); - g_slist_free (strings); + g_slist_free_full (strings, g_free); res = g_slist_reverse (res); } @@ -753,8 +752,7 @@ pluma_prefs_manager_get_shown_in_menu_encodings (void) tmp = g_slist_next (tmp); } - g_slist_foreach (strings, (GFunc) g_free, NULL); - g_slist_free (strings); + g_slist_free_full (strings, g_free); res = g_slist_reverse (res); } diff --git a/pluma/pluma-utils.c b/pluma/pluma-utils.c index 905b8f53..761d0c71 100644 --- a/pluma/pluma-utils.c +++ b/pluma/pluma-utils.c @@ -102,8 +102,7 @@ pluma_utils_uri_has_writable_scheme (const gchar *uri) scheme, (GCompareFunc)strcmp) != NULL); - g_slist_foreach (writable_schemes, (GFunc)g_free, NULL); - g_slist_free (writable_schemes); + g_slist_free_full (writable_schemes, g_free); g_free (scheme); diff --git a/pluma/pluma-window.c b/pluma/pluma-window.c index 6d26cf89..ac78ff71 100644 --- a/pluma/pluma-window.c +++ b/pluma/pluma-window.c @@ -1386,8 +1386,7 @@ update_recent_files_menu (PlumaWindow *window) g_list_free (filtered_items); - g_list_foreach (items, (GFunc) gtk_recent_info_unref, NULL); - g_list_free (items); + g_list_free_full (items, (GDestroyNotify) gtk_recent_info_unref); } static void diff --git a/pluma/pluma.c b/pluma/pluma.c index 12ae069d..99542b65 100644 --- a/pluma/pluma.c +++ b/pluma/pluma.c @@ -128,8 +128,7 @@ static const GOptionEntry options [] = static void free_command_line_data (void) { - g_slist_foreach (file_list, (GFunc) g_object_unref, NULL); - g_slist_free (file_list); + g_slist_free_full (file_list, g_object_unref); file_list = NULL; g_strfreev (remaining_args); -- cgit v1.2.1