diff options
author | rbuj <[email protected]> | 2019-03-14 08:19:47 +0100 |
---|---|---|
committer | ZenWalker <[email protected]> | 2019-04-14 15:24:07 +0200 |
commit | b02b6b0fe430b9dcb137f4aaf24efde94ba70afe (patch) | |
tree | 1d0b8acaea8cf349c6368edef6b30d901d02e084 /cpufreq | |
parent | 538e7566185ccd4f6accd55fcb55644c0223d82f (diff) | |
download | mate-applets-b02b6b0fe430b9dcb137f4aaf24efde94ba70afe.tar.bz2 mate-applets-b02b6b0fe430b9dcb137f4aaf24efde94ba70afe.tar.xz |
Use g_list_free_full() convenience function
void
g_list_free_full (GList *list,
GDestroyNotify free_func);
Convenience method, which frees all the memory used
by a GList, and calls free_func on every element's
data.
https://developer.gnome.org/glib/stable/glib-Doubly-Linked-Lists.html#g-list-free-full
Diffstat (limited to 'cpufreq')
-rw-r--r-- | cpufreq/src/cpufreq-monitor.c | 10 | ||||
-rw-r--r-- | cpufreq/src/cpufreq-selector/cpufreq-selector-sysfs.c | 12 |
2 files changed, 5 insertions, 17 deletions
diff --git a/cpufreq/src/cpufreq-monitor.c b/cpufreq/src/cpufreq-monitor.c index caf962fa..38ffa0e2 100644 --- a/cpufreq/src/cpufreq-monitor.c +++ b/cpufreq/src/cpufreq-monitor.c @@ -175,18 +175,12 @@ cpufreq_monitor_finalize (GObject *object) } if (monitor->priv->available_freqs) { - g_list_foreach (monitor->priv->available_freqs, - (GFunc) g_free, - NULL); - g_list_free (monitor->priv->available_freqs); + g_list_free_full (monitor->priv->available_freqs, g_free); monitor->priv->available_freqs = NULL; } if (monitor->priv->available_govs) { - g_list_foreach (monitor->priv->available_govs, - (GFunc) g_free, - NULL); - g_list_free (monitor->priv->available_govs); + g_list_free_full (monitor->priv->available_govs, g_free); monitor->priv->available_govs = NULL; } diff --git a/cpufreq/src/cpufreq-selector/cpufreq-selector-sysfs.c b/cpufreq/src/cpufreq-selector/cpufreq-selector-sysfs.c index 30e05532..990ea702 100644 --- a/cpufreq/src/cpufreq-selector/cpufreq-selector-sysfs.c +++ b/cpufreq/src/cpufreq-selector/cpufreq-selector-sysfs.c @@ -78,18 +78,12 @@ cpufreq_selector_sysfs_finalize (GObject *object) CPUFreqSelectorSysfs *selector = CPUFREQ_SELECTOR_SYSFS (object); if (selector->priv->available_freqs) { - g_list_foreach (selector->priv->available_freqs, - (GFunc) g_free, - NULL); - g_list_free (selector->priv->available_freqs); + g_list_free_full (selector->priv->available_freqs, g_free); selector->priv->available_freqs = NULL; } - + if (selector->priv->available_govs) { - g_list_foreach (selector->priv->available_govs, - (GFunc) g_free, - NULL); - g_list_free (selector->priv->available_govs); + g_list_free_full (selector->priv->available_govs, g_free); selector->priv->available_govs = NULL; } |