From cb2ec6826f7646ec3a5cf430fdda8b8249cb8f4b Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 18 Sep 2008 23:35:12 +0200 Subject: [PATCH] screen_browser: removed redundant highlight check browser_select_entry() checked the entry's "highlight" flag twice: the first time, it was toggled, and the second time, action was performed based on the flag. Merge the two checks. --- src/screen_browser.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/screen_browser.c b/src/screen_browser.c index b9ef7d4..f3ec8ed 100644 --- a/src/screen_browser.c +++ b/src/screen_browser.c @@ -358,14 +358,11 @@ browser_select_entry(mpdclient_t *c, filelist_entry_t *entry, if (entry->entity->type != MPD_INFO_ENTITY_TYPE_SONG) return -1; - if (toggle && entry->flags & HIGHLIGHT) - entry->flags &= ~HIGHLIGHT; - else - entry->flags |= HIGHLIGHT; - - if (toggle || entry->flags & HIGHLIGHT) { + if (!toggle || (entry->flags & HIGHLIGHT) == 0) { mpd_Song *song = entry->entity->info.song; + entry->flags |= HIGHLIGHT; + if (mpdclient_cmd_add(c, song) == 0) { char buf[BUFSIZE]; @@ -376,6 +373,8 @@ browser_select_entry(mpdclient_t *c, filelist_entry_t *entry, /* remove song from playlist */ mpd_Song *song = entry->entity->info.song; + entry->flags &= ~HIGHLIGHT; + if (song) { int idx; -- 2.30.2