From 5bc4d4e8ff6420a5cf5d8fd898d0afee2fde18b2 Mon Sep 17 00:00:00 2001 From: rbuj Date: Sun, 3 Mar 2019 10:43:16 +0100 Subject: Fix -Werror=cast-function-type with GCC 8 In addition, it removes unnecessary function type casts like: (GDestroyNotify) g_object_unref (GDestroyNotify) g_free --- logview/src/logview-app.c | 3 +-- logview/src/logview-log.c | 11 ++++------- logview/src/logview-manager.c | 5 ++--- logview/src/logview-prefs.c | 4 ++-- 4 files changed, 9 insertions(+), 14 deletions(-) (limited to 'logview') diff --git a/logview/src/logview-app.c b/logview/src/logview-app.c index ffa37ec7..6d30e682 100644 --- a/logview/src/logview-app.c +++ b/logview/src/logview-app.c @@ -145,8 +145,7 @@ enumerate_job_finish (EnumerateJob *job) logview_manager_add_logs_from_name_list (app->priv->manager, files, files->data); - g_slist_foreach (files, (GFunc) g_free, NULL); - g_slist_free (files); + g_slist_free_full (files, g_free); g_object_unref (job->app); g_slice_free (EnumerateJob, job); diff --git a/logview/src/logview-log.c b/logview/src/logview-log.c index 407f49c3..a27202de 100644 --- a/logview/src/logview-log.c +++ b/logview/src/logview-log.c @@ -115,9 +115,8 @@ do_finalize (GObject *obj) } if (log->priv->days) { - g_slist_foreach (log->priv->days, - (GFunc) logview_utils_day_free, NULL); - g_slist_free (log->priv->days); + g_slist_free_full (log->priv->days, + (GDestroyNotify) logview_utils_day_free); log->priv->days = NULL; } @@ -256,8 +255,7 @@ new_lines_job_done (gpointer data) g_clear_object (&job->cancellable); - g_slist_foreach (job->new_days, (GFunc) logview_utils_day_free, NULL); - g_slist_free (job->new_days); + g_slist_free_full (job->new_days, (GDestroyNotify) logview_utils_day_free); /* drop the reference we acquired before */ g_object_unref (job->log); @@ -758,8 +756,7 @@ log_load (GIOSchedulerJob *io_job, if ((days = log_read_dates (parse_data, time (NULL))) != NULL) { log->priv->has_days = TRUE; - g_slist_foreach (days, (GFunc) logview_utils_day_free, NULL); - g_slist_free (days); + g_slist_free_full (days, (GDestroyNotify) logview_utils_day_free); } else { log->priv->has_days = FALSE; } diff --git a/logview/src/logview-manager.c b/logview/src/logview-manager.c index 54b5320b..ca1c423f 100644 --- a/logview/src/logview-manager.c +++ b/logview/src/logview-manager.c @@ -128,7 +128,7 @@ logview_manager_init (LogviewManager *self) priv->active_log = NULL; priv->logs = g_hash_table_new_full (g_str_hash, g_str_equal, - (GDestroyNotify) g_free, (GDestroyNotify) g_object_unref); + g_free, g_object_unref); } static MultipleCreation * @@ -147,9 +147,8 @@ multiple_creation_op_new (int total) static void multiple_creation_op_free (MultipleCreation *mc) { - g_ptr_array_foreach (mc->errors, (GFunc) g_strfreev, NULL); + g_ptr_array_set_free_func (mc->errors, (GDestroyNotify) g_strfreev); g_ptr_array_free (mc->errors, TRUE); - g_slice_free (MultipleCreation, mc); } diff --git a/logview/src/logview-prefs.c b/logview/src/logview-prefs.c index e0fe79c2..877936a8 100644 --- a/logview/src/logview-prefs.c +++ b/logview/src/logview-prefs.c @@ -161,8 +161,8 @@ load_filters (LogviewPrefs *prefs) PREF_FILTERS); prefs->priv->filters = g_hash_table_new_full (g_str_hash, g_str_equal, - (GDestroyNotify) g_free, - (GDestroyNotify) g_object_unref); + g_free, + g_object_unref); for (idx = 0; filters[idx] != NULL; idx++) { str = filters[idx]; -- cgit v1.2.1