[sound-juicer] Replace g_list_deep_free() with g_list_free_full()
- From: Phillip Wood <pwood src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sound-juicer] Replace g_list_deep_free() with g_list_free_full()
- Date: Fri, 5 Sep 2014 10:08:05 +0000 (UTC)
commit 8c5bb72883ab70b63c8d5a5ed1b439b924f94252
Author: Phillip Wood <phillip wood dunelm org uk>
Date: Tue Aug 19 16:32:47 2014 +0100
Replace g_list_deep_free() with g_list_free_full()
Now that g_list_free_full() is in GLib we don't need to roll our own
version. Also use g_list_free_full() rather than g_list_foreach()
followed by g_list_free() to free a list and it's data.
https://bugzilla.gnome.org/show_bug.cgi?id=735091
libjuicer/rb-gst-media-types.c | 3 +--
libjuicer/sj-structures.c | 6 ++----
libjuicer/sj-util.c | 10 ----------
libjuicer/sj-util.h | 2 --
src/sj-extracting.c | 2 +-
src/sj-main.c | 2 +-
6 files changed, 5 insertions(+), 20 deletions(-)
---
diff --git a/libjuicer/rb-gst-media-types.c b/libjuicer/rb-gst-media-types.c
index ef05b9e..6ae8e46 100644
--- a/libjuicer/rb-gst-media-types.c
+++ b/libjuicer/rb-gst-media-types.c
@@ -325,8 +325,7 @@ rb_gst_check_missing_plugins (GstEncodingProfile *profile,
}
ret = TRUE;
- g_list_foreach (messages, (GFunc)gst_message_unref, NULL);
- g_list_free (messages);
+ g_list_free_full (messages, (GDestroyNotify)gst_message_unref);
}
} else {
diff --git a/libjuicer/sj-structures.c b/libjuicer/sj-structures.c
index ec7ceda..ebd7181 100644
--- a/libjuicer/sj-structures.c
+++ b/libjuicer/sj-structures.c
@@ -51,8 +51,7 @@ void album_details_free(AlbumDetails *album)
g_free (album->genre);
g_free (album->album_id);
if (album->release_date) gst_date_time_unref (album->release_date);
- g_list_foreach (album->tracks, (GFunc)track_details_free, NULL);
- g_list_free (album->tracks);
+ g_list_free_full (album->tracks, (GDestroyNotify)track_details_free);
g_free (album->artist_sortname);
g_free (album->artist_id);
g_free (album->asin);
@@ -61,8 +60,7 @@ void album_details_free(AlbumDetails *album)
g_free (album->lyrics_url);
g_free (album->country);
g_free (album->type);
- g_list_foreach (album->labels, (GFunc)label_details_free, NULL);
- g_list_free (album->labels);
+ g_list_free_full (album->labels, (GDestroyNotify)label_details_free);
g_free (album);
}
diff --git a/libjuicer/sj-util.c b/libjuicer/sj-util.c
index 61a56c2..e050068 100644
--- a/libjuicer/sj-util.c
+++ b/libjuicer/sj-util.c
@@ -24,16 +24,6 @@
#endif /* HAVE_CONFIG_H */
#include "sj-util.h"
-/* Pass NULL to use g_free */
-void
-g_list_deep_free (GList *l, GFunc free_func)
-{
- g_return_if_fail (l != NULL);
- if (free_func == NULL) free_func = (GFunc)g_free;
- g_list_foreach (l, free_func, NULL);
- g_list_free (l);
-}
-
GFile *
sj_get_default_music_directory (void)
{
diff --git a/libjuicer/sj-util.h b/libjuicer/sj-util.h
index f9ea18a..d5e5fb0 100644
--- a/libjuicer/sj-util.h
+++ b/libjuicer/sj-util.h
@@ -26,8 +26,6 @@
#include <gio/gio.h>
#include <gtk/gtk.h>
-void g_list_deep_free (GList *l, GFunc free_func);
-
void sj_add_default_dirs (GtkFileChooser *dialog);
GFile *sj_get_default_music_directory (void);
gboolean sj_str_is_empty (const char *s);
diff --git a/src/sj-extracting.c b/src/sj-extracting.c
index 221544e..2aca602 100644
--- a/src/sj-extracting.c
+++ b/src/sj-extracting.c
@@ -224,7 +224,7 @@ cleanup (void)
/* Free the used data */
if (paths) {
- g_list_deep_free (paths, NULL);
+ g_list_free_full (paths, g_free);
paths = NULL;
}
/* Forcibly invalidate the iterator */
diff --git a/src/sj-main.c b/src/sj-main.c
index b6f56cc..9af2b0c 100644
--- a/src/sj-main.c
+++ b/src/sj-main.c
@@ -1163,7 +1163,7 @@ metadata_cb (SjMetadataGetter *m, GList *albums, GError *error)
/* Concentrate here. We remove the album we want from the list, and then
deep-free the list. */
albums = g_list_remove (albums, current_album);
- g_list_deep_free (albums, (GFunc)album_details_free);
+ g_list_free_full (albums, (GDestroyNotify)album_details_free);
albums = NULL;
} else {
current_album = albums->data;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]