[rhythmbox: 3/5] podcast: always use rb_podcast_parse_channel_new () for creating new channel




commit 4cbfee6220161088d0ed58cd7ee49836aebe6187
Author: crvi <crvisqr gmail com>
Date:   Wed Mar 3 04:45:07 2021 +0530

    podcast: always use rb_podcast_parse_channel_new () for creating new channel

 podcast/rb-podcast-manager.c       | 2 +-
 podcast/rb-podcast-parse.c         | 2 ++
 podcast/rb-podcast-search-itunes.c | 2 +-
 podcast/test-podcast-parse.c       | 2 +-
 4 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/podcast/rb-podcast-manager.c b/podcast/rb-podcast-manager.c
index 59c95a111..1e014b9db 100644
--- a/podcast/rb-podcast-manager.c
+++ b/podcast/rb-podcast-manager.c
@@ -824,7 +824,7 @@ rb_podcast_manager_subscribe_feed (RBPodcastManager *pd, const char *url, gboole
        update = g_new0 (RBPodcastUpdate, 1);
        update->pd = g_object_ref (pd);
        update->automatic = automatic;
-       update->channel = g_new0 (RBPodcastChannel, 1);
+       update->channel = rb_podcast_parse_channel_new ();
        update->channel->url = g_strdup (feed_url);
 
        entry = rhythmdb_entry_lookup_by_location (pd->priv->db, feed_url);
diff --git a/podcast/rb-podcast-parse.c b/podcast/rb-podcast-parse.c
index 19b9f865a..1f4b4b490 100644
--- a/podcast/rb-podcast-parse.c
+++ b/podcast/rb-podcast-parse.c
@@ -270,6 +270,8 @@ void
 rb_podcast_parse_channel_unref (RBPodcastChannel *data)
 {
        g_return_if_fail (data != NULL);
+       g_return_if_fail (data->refcount > 0);
+
        g_assert (rb_is_main_thread ());
 
        if (--data->refcount > 0) {
diff --git a/podcast/rb-podcast-search-itunes.c b/podcast/rb-podcast-search-itunes.c
index f66859a31..707376878 100644
--- a/podcast/rb-podcast-search-itunes.c
+++ b/podcast/rb-podcast-search-itunes.c
@@ -81,7 +81,7 @@ process_results (RBPodcastSearchITunes *search, JsonParser *parser)
 
                /* check wrapperType==track, kind==podcast ? */
 
-               channel = g_new0 (RBPodcastChannel, 1);
+               channel = rb_podcast_parse_channel_new ();
 
                channel->url = g_strdup (json_object_get_string_member (feed, "collectionViewUrl"));
                channel->title = g_strdup (json_object_get_string_member (feed, "collectionName"));
diff --git a/podcast/test-podcast-parse.c b/podcast/test-podcast-parse.c
index b87b81a93..709a17e0c 100644
--- a/podcast/test-podcast-parse.c
+++ b/podcast/test-podcast-parse.c
@@ -121,7 +121,7 @@ main (int argc, char **argv)
        }
 
        ml = g_main_loop_new (NULL, FALSE);
-       data = g_new0 (RBPodcastChannel, 1);
+       data = rb_podcast_parse_channel_new ();
        data->url = g_strdup (argv[1]);
        rb_podcast_parse_load_feed (data, NULL, parse_cb, ml);
 


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