Cleaning up addToStoredPlaylist. Now we call freeJustSong if adding a URL.

git-svn-id: https://svn.musicpd.org/mpd/trunk@6269 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
J. Alexander Treuman 2007-05-26 15:00:38 +00:00
parent f16e372871
commit d14a655901

View File

@ -586,17 +586,26 @@ int addToStoredPlaylist(int fd, char *url, char *utf8file)
DEBUG("add to stored playlist: %s\n", url); DEBUG("add to stored playlist: %s\n", url);
if ((song = getSongFromDB(url))) { song = getSongFromDB(url);
} else if (!(isValidRemoteUtf8Url(url) && if (song) {
(song = newSong(url, SONG_TYPE_URL, NULL)))) { appendSongToStoredPlaylistByPath(fd, utf8file, song);
commandError(fd, ACK_ERROR_NO_EXIST, return 0;
"\"%s\" is not in the music db or is "
"not a valid url", url);
return -1;
} }
appendSongToStoredPlaylistByPath(fd, utf8file, song); if (!isValidRemoteUtf8Url(url))
return 0; goto fail;
song = newSong(url, SONG_TYPE_URL, NULL);
if (song) {
appendSongToStoredPlaylistByPath(fd, utf8file, song);
freeJustSong(song);
return 0;
}
fail:
commandError(fd, ACK_ERROR_NO_EXIST, "\"%s\" is not in the music db"
"or is not a valid url", url);
return -1;
} }
int addSongToPlaylist(int fd, Song * song, int printId) int addSongToPlaylist(int fd, Song * song, int printId)