[sound-juicer] Use g_slist_free_full() to free lists



commit bd159067d743d120d3db6a0fa61ce11b8c517bf1
Author: Phillip Wood <phillip wood dunelm org uk>
Date:   Tue Aug 19 16:33:09 2014 +0100

    Use g_slist_free_full() to free lists
    
    Rather than using g_slist_foreach() followed by g_slist_free() to free
    a list and it's data just call g_slist_free_full().
    
    https://bugzilla.gnome.org/show_bug.cgi?id=735092

 src/sj-main.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)
---
diff --git a/src/sj-main.c b/src/sj-main.c
index 35c7cde..b6f56cc 100644
--- a/src/sj-main.c
+++ b/src/sj-main.c
@@ -1426,8 +1426,7 @@ prefs_get_default_device (void)
     drive = drives->data;
     default_device = brasero_drive_get_device (drive);
 
-    g_slist_foreach (drives, (GFunc) g_object_unref, NULL);
-    g_slist_free (drives);
+    g_slist_free_full (drives, g_object_unref);
   }
   return default_device;
 }
@@ -2022,14 +2021,12 @@ is_cd_duplication_available(void)
 
     drive = iter->data;
     if (brasero_drive_can_write (drive)) {
-      g_slist_foreach (drives, (GFunc) g_object_unref, NULL);
-      g_slist_free (drives);
+      g_slist_free_full (drives, g_object_unref);
       return TRUE;
     }
   }
 
-  g_slist_foreach (drives, (GFunc) g_object_unref, NULL);
-  g_slist_free (drives);
+  g_slist_free_full (drives, g_object_unref);
   return FALSE;
 }
 


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