aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist.c
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2008-01-01 10:09:36 +0000
committerEric Wong <normalperson@yhbt.net>2008-01-01 10:09:36 +0000
commit1b4de32706f6c43c4833146a98b0689cbe624fe6 (patch)
tree7a63f6c2036c4ebaac076fdb9126bafcd04e27d3 /src/playlist.c
parent09936358fa8098444019fc2a470b1685af1a19de (diff)
downloadmpd-1b4de32706f6c43c4833146a98b0689cbe624fe6.tar.gz
mpd-1b4de32706f6c43c4833146a98b0689cbe624fe6.tar.xz
mpd-1b4de32706f6c43c4833146a98b0689cbe624fe6.zip
storedPlaylist: remove the needless StoredPlaylist struct and just use List
Abstractions should reduce the amount of code and make things easier to follow. The StoredPlaylist struct did not do that, so get rid of it and just use our standard linked list implementation instead. diffstat agrees with me that the abstraction is pointless: 3 files changed, 60 insertions(+), 90 deletions(-) git-svn-id: https://svn.musicpd.org/mpd/trunk@7120 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--src/playlist.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/playlist.c b/src/playlist.c
index 3087fd444..4689cc2de 100644
--- a/src/playlist.c
+++ b/src/playlist.c
@@ -1516,12 +1516,12 @@ int getPlaylistSongId(int song)
int PlaylistInfo(int fd, char *utf8file, int detail)
{
ListNode *node;
- StoredPlaylist sp;
+ List *list;
- if (loadStoredPlaylist(fd, &sp, utf8file) < 0)
+ if (!(list = loadStoredPlaylist(fd, utf8file)))
return -1;
- node = sp.list->firstNode;
+ node = list->firstNode;
while (node != NULL) {
char *temp = node->data;
int wrote = 0;
@@ -1541,19 +1541,19 @@ int PlaylistInfo(int fd, char *utf8file, int detail)
node = node->nextNode;
}
- freeStoredPlaylist(&sp);
+ freeList(list);
return 0;
}
int loadPlaylist(int fd, char *utf8file)
{
ListNode *node;
- StoredPlaylist sp;
+ List *list;
- if (loadStoredPlaylist(fd, &sp, utf8file) < 0)
+ if (!(list = loadStoredPlaylist(fd, utf8file)))
return -1;
- node = sp.list->firstNode;
+ node = list->firstNode;
while (node != NULL) {
char *temp = node->data;
if ((addToPlaylist(STDERR_FILENO, temp, 0)) < 0) {
@@ -1575,7 +1575,7 @@ int loadPlaylist(int fd, char *utf8file)
node = node->nextNode;
}
- freeStoredPlaylist(&sp);
+ freeList(list);
return 0;
}