playlist: Optimize playlist_remove_all_tracks()

This was insanely slow for large playlists. Implement it as a
constant-time operation to avoid the O(N!) blowup, and add a
new "clear" command to the control file to avoid flooding it
with individual delete commands.

Change-Id: Ied82d1cba015591edd583f2a2ff6772108f4e176
This commit is contained in:
Aidan MacDonald 2023-01-22 01:27:16 +00:00
parent 2c4546ba99
commit 25bd3bc971
2 changed files with 89 additions and 21 deletions

View file

@ -47,6 +47,7 @@ enum playlist_command {
PLAYLIST_COMMAND_SHUFFLE,
PLAYLIST_COMMAND_UNSHUFFLE,
PLAYLIST_COMMAND_RESET,
PLAYLIST_COMMAND_CLEAR,
PLAYLIST_COMMAND_COMMENT
};