From: Max Kellermann Date: Thu, 18 Sep 2008 21:35:12 +0000 (+0200) Subject: screen_browser: removed redundant highlight check X-Git-Tag: v0.12_alpha1~232 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=cb2ec6826f7646ec3a5cf430fdda8b8249cb8f4b;p=ncmpc.git 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. --- 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;