[grilo-plugins/0.1.x] plugins: Use g_list_free_full() when possible



commit 31ffa8057367736f653791c75410c35af79ac631
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date:   Fri Apr 20 12:52:39 2012 +0000

    plugins: Use g_list_free_full() when possible
    
    Signed-off-by: Juan A. Suarez Romero <jasuarez igalia com>

 src/media/filesystem/grl-filesystem.c       |    8 ++------
 src/media/flickr/gflickr.c                  |   12 ++++--------
 src/media/optical-media/grl-optical-media.c |    3 +--
 src/media/tracker/grl-tracker-utils.c       |    3 +--
 src/media/vimeo/gvimeo.c                    |    3 +--
 5 files changed, 9 insertions(+), 20 deletions(-)
---
diff --git a/src/media/filesystem/grl-filesystem.c b/src/media/filesystem/grl-filesystem.c
index 7c93a0e..2a47ea8 100644
--- a/src/media/filesystem/grl-filesystem.c
+++ b/src/media/filesystem/grl-filesystem.c
@@ -240,8 +240,7 @@ static void
 grl_filesystem_source_finalize (GObject *object)
 {
   GrlFilesystemSource *filesystem_source = GRL_FILESYSTEM_SOURCE (object);
-  g_list_foreach (filesystem_source->priv->chosen_paths, (GFunc) g_free, NULL);
-  g_list_free (filesystem_source->priv->chosen_paths);
+  g_list_free_full (filesystem_source->priv->chosen_paths, g_free);
   g_hash_table_unref (filesystem_source->priv->cancellables);
   G_OBJECT_CLASS (grl_filesystem_source_parent_class)->finalize (object);
 }
@@ -1059,10 +1058,7 @@ cancel_monitors (GrlFilesystemSource *fs_source)
   g_list_foreach (fs_source->priv->monitors,
                   (GFunc) g_file_monitor_cancel,
                   NULL);
-  g_list_foreach (fs_source->priv->monitors,
-                  (GFunc) g_object_unref,
-                  NULL);
-  g_list_free (fs_source->priv->monitors);
+  g_list_free_full (fs_source->priv->monitors, g_object_unref);
   fs_source->priv->monitors = NULL;
 }
 
diff --git a/src/media/flickr/gflickr.c b/src/media/flickr/gflickr.c
index 695c7dc..dc9e7bb 100644
--- a/src/media/flickr/gflickr.c
+++ b/src/media/flickr/gflickr.c
@@ -446,8 +446,7 @@ process_photolist_result (const gchar *xml_result, gpointer user_data)
     }
 
     data->list_cb (data->flickr, g_list_reverse (photolist), data->user_data);
-    g_list_foreach (photolist, (GFunc) g_hash_table_unref, NULL);
-    g_list_free (photolist);
+    g_list_free_full (photolist, (GDestroyNotify) g_hash_table_unref);
   }
   g_object_unref (data->flickr);
   g_slice_free (GFlickrData, data);
@@ -480,8 +479,7 @@ process_taglist_result (const gchar *xml_result, gpointer user_data)
     }
 
     data->list_cb (data->flickr, g_list_reverse (taglist), data->user_data);
-    g_list_foreach (taglist, (GFunc) g_free, NULL);
-    g_list_free (taglist);
+    g_list_free_full (taglist, g_free);
   }
   g_object_unref (data->flickr);
   g_slice_free (GFlickrData, data);
@@ -514,8 +512,7 @@ process_photosetslist_result (const gchar *xml_result, gpointer user_data)
     }
 
     data->list_cb (data->flickr, g_list_reverse (photosets), data->user_data);
-    g_list_foreach (photosets, (GFunc) g_hash_table_unref, NULL);
-    g_list_free (photosets);
+    g_list_free_full (photosets, (GDestroyNotify) g_hash_table_unref);
   }
   g_object_unref (data->flickr);
   g_slice_free (GFlickrData, data);
@@ -548,8 +545,7 @@ process_photosetsphotos_result (const gchar *xml_result, gpointer user_data)
     }
 
     data->list_cb (data->flickr, g_list_reverse (list), data->user_data);
-    g_list_foreach (list, (GFunc) g_hash_table_unref, NULL);
-    g_list_free (list);
+    g_list_free_full (list, (GDestroyNotify) g_hash_table_unref);
   }
   g_object_unref (data->flickr);
   g_slice_free (GFlickrData, data);
diff --git a/src/media/optical-media/grl-optical-media.c b/src/media/optical-media/grl-optical-media.c
index 149ad3d..2847991 100644
--- a/src/media/optical-media/grl-optical-media.c
+++ b/src/media/optical-media/grl-optical-media.c
@@ -447,8 +447,7 @@ resolve_disc_urls (BrowseData *data)
     /* If we got cancelled, there's still some media
      * to resolve here */
     if (data->media_list) {
-      g_list_foreach (data->media_list, (GFunc) g_object_unref, NULL);
-      g_list_free (data->media_list);
+      g_list_free_full (data->media_list, g_object_unref);
     }
     /* No media left, we're done */
     data->bs->callback (data->bs->source,
diff --git a/src/media/tracker/grl-tracker-utils.c b/src/media/tracker/grl-tracker-utils.c
index 8932a32..ecedb08 100644
--- a/src/media/tracker/grl-tracker-utils.c
+++ b/src/media/tracker/grl-tracker-utils.c
@@ -585,8 +585,7 @@ get_tracker_volume_name (const gchar *uri,
 
       mount = mount->next;
     }
-    g_list_foreach (mounts, (GFunc) g_object_unref, NULL);
-    g_list_free (mounts);
+    g_list_free_full (mounts, g_object_unref);
     g_object_unref (G_OBJECT (file));
     g_object_unref (G_OBJECT (volume_monitor));
   } else {
diff --git a/src/media/vimeo/gvimeo.c b/src/media/vimeo/gvimeo.c
index 4d77db6..4f61453 100644
--- a/src/media/vimeo/gvimeo.c
+++ b/src/media/vimeo/gvimeo.c
@@ -352,8 +352,7 @@ process_video_search_result (const gchar *xml_result, gpointer user_data)
     }
 
     data->search_cb (data->vimeo, g_list_reverse (video_list), data->user_data);
-    g_list_foreach (video_list, (GFunc) g_hash_table_unref, NULL);
-    g_list_free (video_list);
+    g_list_free_full (video_list, (GDestroyNotify) g_hash_table_unref);
   }
   g_slice_free (GVimeoVideoSearchData, data);
   xmlFreeDoc (doc);



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