X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=playlist.c;h=62fd831acfa1bff04097b59dad33b3b22cee41f6;hp=1c496cae506a0289e805b1a98729b16399ab5065;hb=c184f843500dd59baa95fbbbab962a1691bf0217;hpb=e443c5192f54d8a9820c87e957b74490c1a279ae diff --git a/playlist.c b/playlist.c index 1c496cae..62fd831a 100644 --- a/playlist.c +++ b/playlist.c @@ -144,6 +144,8 @@ int playlist_check_callback(__a_unused const struct osl_object *query, */ void playlist_close(void) { + if (!current_playlist.name) + return; free(current_playlist.name); current_playlist.name = NULL; } @@ -171,8 +173,9 @@ int playlist_open(char *name) PARA_NOTICE_LOG("failed to load playlist %s\n", name); return ret; } + playlist_close(); ret = load_playlist(row, ¤t_playlist); - return (ret == -E_PLAYLIST_LOADED)? 1 : ret; + return (ret == -E_PLAYLIST_LOADED)? current_playlist.length : ret; } static int search_path(char *path, void *data) @@ -220,8 +223,8 @@ static int handle_audio_file_event(enum afs_events event, void *data) return score_add(row, 0); /* play it immediately */ } -int playlists_event_handler(enum afs_events event, struct para_buffer *pb, - void *data) +int playlists_event_handler(enum afs_events event, + __a_unused struct para_buffer *pb, void *data) { int ret;