commit cd070aeadabc033a40fc829a21f62b4a37684a8c from: Omar Polo date: Thu Feb 17 10:39:34 2022 UTC add playlist_free commit - 532ca63cfb62d6e60321aff668a4330fdd0a7fb5 commit + cd070aeadabc033a40fc829a21f62b4a37684a8c blob - bbbe6b703ba393af1b822c6284a07f989c6a250f blob + 50c3ce9a701bfc4d6ab0ceabedfd6f0a546646bc --- playlist.c +++ playlist.c @@ -114,17 +114,23 @@ playlist_reset(void) } void -playlist_truncate(void) +playlist_free(struct playlist *playlist) { size_t i; - for (i = 0; i < playlist.len; ++i) - free(playlist.songs[i]); - free(playlist.songs); - playlist.songs = NULL; + for (i = 0; i < playlist->len; ++i) + free(playlist->songs[i]); + free(playlist->songs); + playlist->songs = NULL; - playlist.len = 0; - playlist.cap = 0; + playlist->len = 0; + playlist->cap = 0; +} + +void +playlist_truncate(void) +{ + playlist_free(&playlist); play_off = -1; } blob - 8adc896b043149dd519d45be13646d7288c0ebe4 blob + 62c2fe10cddf05aca8db7b5da5cdb53d38b563cd --- playlist.h +++ playlist.h @@ -42,6 +42,7 @@ const char *playlist_current(void); const char *playlist_advance(void); const char *playlist_previous(void); void playlist_reset(void); +void playlist_free(struct playlist *); void playlist_truncate(void); void playlist_dropcurrent(void);