changeset 3474:adc785ee517b trunk

Add playlist_playlists_equal for comparing entire playlists
author Kieran Clancy <clancy.kieran+audacious@gmail.com>
date Mon, 10 Sep 2007 13:45:41 +0930
parents 3b26640f9fd6
children 80cff88ad6d0
files src/audacious/playlist.c src/audacious/playlist.h
diffstat 2 files changed, 22 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/playlist.c	Mon Sep 10 13:44:49 2007 +0930
+++ b/src/audacious/playlist.c	Mon Sep 10 13:45:41 2007 +0930
@@ -3315,3 +3315,23 @@
 
     return playlist->position;
 }
+
+gboolean
+playlist_playlists_equal(Playlist *p1, Playlist *p2)
+{
+    GList *l1, *l2;
+    PlaylistEntry *e1, *e2;
+    if (!p1 || !p2) return FALSE;
+    l1 = p1->entries;
+    l2 = p2->entries;
+    do {
+        if (!l1 && !l2) break;
+        if (!l1 || !l2) return FALSE; /* different length */
+        e1 = (PlaylistEntry *) l1->data;
+        e2 = (PlaylistEntry *) l2->data;
+        if (strcmp(e1->filename, e2->filename) != 0) return FALSE;
+        l1 = l1->next;
+        l2 = l2->next;
+    } while(1);
+    return TRUE;
+}
--- a/src/audacious/playlist.h	Mon Sep 10 13:44:49 2007 +0930
+++ b/src/audacious/playlist.h	Mon Sep 10 13:45:41 2007 +0930
@@ -237,6 +237,8 @@
 
 Playlist *playlist_get_active(void);
 
+gboolean playlist_playlists_equal(Playlist *p1, Playlist *p2);
+
 G_END_DECLS
 
 #endif