From fcb6239aba523f054662e090bdcb4cb82148e450 Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Sat, 21 Jan 2023 16:28:30 +0000 Subject: [PATCH] playlist: Remove current flag Only current_playlist will have it set, so compare pointers instead. Change-Id: I46dc7baef9699990962176db7c8796bba1e4809d --- apps/playlist.c | 7 +++---- apps/playlist.h | 1 - 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/apps/playlist.c b/apps/playlist.c index 7bdcafa69a..77e3d20151 100644 --- a/apps/playlist.c +++ b/apps/playlist.c @@ -560,7 +560,7 @@ static void empty_playlist_unlocked(struct playlist_info* playlist, bool resume) playlist->pending_control_sync = false; playlist->shuffle_modified = false; - if (!resume && playlist->current) + if (!resume && playlist == ¤t_playlist) { /* start with fresh playlist control file when starting new playlist */ @@ -650,7 +650,8 @@ static void new_playlist_unlocked(struct playlist_info* playlist, { fileused = ""; - if (dirused && playlist->current) /* !current cannot be in_ram */ + /* only the current playlist can be in RAM */ + if (dirused && playlist == ¤t_playlist) playlist->in_ram = true; else dirused = ""; /* empty playlist */ @@ -2076,7 +2077,6 @@ void playlist_init(void) int handle; struct playlist_info* playlist = ¤t_playlist; - playlist->current = true; strmemccpy(playlist->control_filename, PLAYLIST_CONTROL_FILE, sizeof(playlist->control_filename)); playlist->fd = -1; @@ -2201,7 +2201,6 @@ int playlist_create_ex(struct playlist_info* playlist, { /* Initialize playlist structure */ int r = rand() % 10; - playlist->current = false; /* Use random name for control file */ snprintf(playlist->control_filename, sizeof(playlist->control_filename), diff --git a/apps/playlist.h b/apps/playlist.h index 86c0c293ab..5a8f3ec360 100644 --- a/apps/playlist.h +++ b/apps/playlist.h @@ -75,7 +75,6 @@ struct playlist_control_cache { struct playlist_info { - bool current; /* current playing playlist */ bool utf8; /* playlist is in .m3u8 format */ bool control_created; /* has control file been created? */ bool in_ram; /* playlist stored in ram (dirplay) */