changeset 2121:185db04b815f trunk

[svn] - remove all improper uses of playlist_get()
author nenolod
date Fri, 15 Dec 2006 07:23:19 -0800
parents 1d67cf383e32
children 7177279f9d26
files ChangeLog audacious/playlist.c
diffstat 2 files changed, 23 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Dec 15 07:20:41 2006 -0800
+++ b/ChangeLog	Fri Dec 15 07:23:19 2006 -0800
@@ -1,3 +1,13 @@
+2006-12-15 15:20:41 +0000  William Pitcock <nenolod@nenolod.net>
+  revision [3245]
+  - dynamically allocate the playlist at startup and fix some lingering improper uses of playlist_get()
+  
+  trunk/audacious/main.c     |    4 +++
+  trunk/audacious/playlist.c |   53 ++++++++++++++++++++++++++++++++++++++-------
+  trunk/audacious/playlist.h |    3 ++
+  3 files changed, 52 insertions(+), 8 deletions(-)
+
+
 2006-12-14 07:15:44 +0000  William Pitcock <nenolod@nenolod.net>
   revision [3243]
   - fix example
--- a/audacious/playlist.c	Fri Dec 15 07:20:41 2006 -0800
+++ b/audacious/playlist.c	Fri Dec 15 07:23:19 2006 -0800
@@ -870,7 +870,7 @@
         g_free(decoded);
 
         PLAYLIST_LOCK();
-        node = g_list_nth(playlist_get(), pos);
+        node = g_list_nth(playlist->entries, pos);
         PLAYLIST_UNLOCK();
 
         entries += i;
@@ -2314,7 +2314,7 @@
             playlist_get_info_scan_active) {
 
             PLAYLIST_LOCK();
-            for (node = playlist_get(); node; node = g_list_next(node)) {
+            for (node = playlist->entries; node; node = g_list_next(node)) {
                 entry = node->data;
 
                 if(entry->tuple && (entry->tuple->length > -1)) {
@@ -2323,10 +2323,10 @@
                 }
 
                 if (!playlist_entry_get_info(entry)) {
-                    if (g_list_index(playlist_get(), entry) == -1)
+                    if (g_list_index(playlist->entries, entry) == -1)
                         /* Entry disappeared while we looked it up.
                            Restart. */
-                        node = playlist_get();
+                        node = playlist->entries;
                 }
                 else if ((entry->tuple != NULL || entry->title != NULL) && entry->length != -1) {
                     update_playlistwin = TRUE;
@@ -2357,12 +2357,12 @@
 
             PLAYLIST_LOCK();
 
-            if (!playlist_get()) {
+            if (!playlist->entries) {
                 PLAYLIST_UNLOCK();
             }
             else {
-                for (node = g_list_nth(playlist_get(), playlistwin_get_toprow());
-                     node && playlistwin_item_visible(g_list_position(playlist_get(), node));
+                for (node = g_list_nth(playlist->entries, playlistwin_get_toprow());
+                     node && playlistwin_item_visible(g_list_position(playlist->entries, node));
                      node = g_list_next(node)) {
 
                     entry = node->data;
@@ -2373,11 +2373,11 @@
                     }
 
                     if (!playlist_entry_get_info(entry)) { 
-                        if (g_list_index(playlist_get(), entry) == -1)
+                        if (g_list_index(playlist->entries, entry) == -1)
                             /* Entry disapeared while we
                                looked it up.  Restart. */
                             node =
-                                g_list_nth(playlist_get(),
+                                g_list_nth(playlist->entries,
                                            playlistwin_get_toprow());
                     }
                     else if ((entry->tuple != NULL || entry->title != NULL) && entry->length != -1) {
@@ -2773,7 +2773,7 @@
 
     PLAYLIST_LOCK();
 
-    for (node = playlist_get(); node; node = g_list_next(node)) {
+    for (node = playlist->entries; node; node = g_list_next(node)) {
         PlaylistEntry *entry = node->data;
         if (!entry->selected)
             continue;
@@ -2788,9 +2788,9 @@
 	    entry->tuple->mtime = -1; /* -1 denotes "non-initialized". now 0 is for stream etc. yaz */
 
         if (!playlist_entry_get_info(entry)) {
-            if (g_list_index(playlist_get(), entry) == -1)
+            if (g_list_index(playlist->entries, entry) == -1)
                 /* Entry disappeared while we looked it up. Restart. */
-                node = playlist_get();
+                node = playlist->entries;
         }
     }
 
@@ -2809,7 +2809,7 @@
 
     PLAYLIST_LOCK();
 
-    if ((node = g_list_nth(playlist_get(), pos))) {
+    if ((node = g_list_nth(playlist->entries, pos))) {
         PlaylistEntry *entry = node->data;
         str_replace_in(&entry->title, NULL);
         entry->length = -1;