[PATCH grilo-plugins 1/3] jamendo: avoid extra mem allocs



There's no need to allocate and free a struct here

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez igalia com>
---
 src/jamendo/grl-jamendo.c |   22 ++++++++++------------
 1 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/src/jamendo/grl-jamendo.c b/src/jamendo/grl-jamendo.c
index 8e4e030..70cf755 100644
--- a/src/jamendo/grl-jamendo.c
+++ b/src/jamendo/grl-jamendo.c
@@ -725,25 +725,23 @@ update_media_from_root (GrlMedia *media)
 static void
 update_media_from_artists (GrlMedia *media)
 {
-  Entry *entry;
+  Entry entry = {
+    .category = JAMENDO_ARTIST_CAT,
+    .artist_name = JAMENDO_ARTIST "s",
+  };
 
-  entry = g_slice_new0 (Entry);
-  entry->category = JAMENDO_ARTIST_CAT;
-  entry->artist_name = g_strdup (JAMENDO_ARTIST "s");
-  update_media_from_entry (media, entry);
-  free_entry (entry);
+  update_media_from_entry (media, &entry);
 }
 
 static void
 update_media_from_albums (GrlMedia *media)
 {
-  Entry *entry;
+  Entry entry = {
+    .category = JAMENDO_ALBUM_CAT,
+    .album_name = JAMENDO_ALBUM "s",
+  };
 
-  entry = g_slice_new0 (Entry);
-  entry->category = JAMENDO_ALBUM_CAT;
-  entry->album_name = g_strdup (JAMENDO_ALBUM "s");
-  update_media_from_entry (media, entry);
-  free_entry (entry);
+  update_media_from_entry (media, &entry);
 }
 
 static void
-- 
1.7.1



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]