# HG changeset patch # User yaz # Date 1171860173 28800 # Node ID 68d1e9761cc5e68f0af612145a1f679ca2cd1949 # Parent 8ac0dcad22e30b8506cd1112c3223209a9260cf0 [svn] - highly experimental code to speed up loading huge playlist. let me know if it breaks something. diff -r 8ac0dcad22e3 -r 68d1e9761cc5 ChangeLog --- a/ChangeLog Sun Feb 18 20:40:14 2007 -0800 +++ b/ChangeLog Sun Feb 18 20:42:53 2007 -0800 @@ -1,3 +1,11 @@ +2007-02-19 04:40:14 +0000 Yoshiki Yazawa + revision [4104] + - changes in r4102 break jtf. disabled for now. + + trunk/src/audacious/ui_jumptotrack.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + + 2007-02-18 15:24:13 +0000 William Pitcock revision [4102] - run gtk events while iterating through the playlist diff -r 8ac0dcad22e3 -r 68d1e9761cc5 src/audacious/build_stamp.c --- a/src/audacious/build_stamp.c Sun Feb 18 20:40:14 2007 -0800 +++ b/src/audacious/build_stamp.c Sun Feb 18 20:42:53 2007 -0800 @@ -1,2 +1,2 @@ #include -const gchar *svn_stamp = "20070218-4102"; +const gchar *svn_stamp = "20070219-4104"; diff -r 8ac0dcad22e3 -r 68d1e9761cc5 src/audacious/playlist.c --- a/src/audacious/playlist.c Sun Feb 18 20:40:14 2007 -0800 +++ b/src/audacious/playlist.c Sun Feb 18 20:42:53 2007 -0800 @@ -615,22 +615,37 @@ TitleInput *tuple, InputPlugin * dec) { - GList *node; PlaylistEntry *entry; g_return_if_fail(playlist != NULL); g_return_if_fail(filename != NULL); + entry = playlist_entry_new(filename, tuple->track_name, tuple->length, dec); + if(!playlist->tail) + playlist->tail = g_list_last(playlist->entries); + PLAYLIST_LOCK(playlist->mutex); - playlist->entries = g_list_insert(playlist->entries, - playlist_entry_new(filename, tuple->track_name, tuple->length, dec), - pos); - - if (pos < 0) - pos = g_list_length(playlist->entries) - 1; /* last element. */ - - node = g_list_nth(playlist->entries, pos); - entry = PLAYLIST_ENTRY(node->data); + + if(pos == -1) { // the common case + GList *element; + element = g_list_alloc(); + element->data = entry; + element->prev = playlist->tail; // NULL is allowed here. + element->next = NULL; + + if(!playlist->entries) { // this is the first element + playlist->entries = element; + playlist->tail = element; + } + else { // the rests + g_return_if_fail(playlist->tail != NULL); + playlist->tail->next = element; + playlist->tail = element; + } + } + else { + playlist->entries = g_list_insert(playlist->entries, entry, pos); + } if (tuple != NULL) { entry->title = xmms_get_titlestring(tuple->formatter != NULL ? tuple->formatter : xmms_get_gentitle_format(), tuple); diff -r 8ac0dcad22e3 -r 68d1e9761cc5 src/audacious/playlist.h --- a/src/audacious/playlist.h Sun Feb 18 20:40:14 2007 -0800 +++ b/src/audacious/playlist.h Sun Feb 18 20:42:53 2007 -0800 @@ -77,6 +77,7 @@ gboolean pl_selection_more; gboolean loading_playlist; GMutex *mutex; /* this is required for multiple playlist */ + GList *tail; /* marker for the last element in playlist->entries */ } Playlist; typedef enum {