From a5fc3b01ba71171c854d1f1654b3abf38e785d5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Mon, 29 Aug 2016 01:38:46 +0200 Subject: [PATCH] (Menu) Implement playlist_delete_index --- playlist.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/playlist.c b/playlist.c index 0451591594..5ad11904a4 100644 --- a/playlist.c +++ b/playlist.c @@ -103,11 +103,12 @@ void playlist_delete_index(playlist_t *playlist, if (!playlist) return; - const char *label = NULL; + memmove(playlist->entries + idx, playlist->entries + idx + 1, + (playlist->size - idx) * sizeof(struct playlist_entry)); - playlist_get_index(playlist, idx, NULL, &label, NULL, NULL, NULL, NULL); + playlist->size = playlist->size - 1; - printf("%s %zu\n", label, idx); + playlist_write_file(playlist); } void playlist_get_index_by_path(playlist_t *playlist,