Commit: 55f402a0d3b9c1b81eb79a2cb7ac9e1aaac524bc
Parent: bc0ff7dbd6d4725f8a07c65139ce464b6454591a
Author: Randy Palamar
Date: Fri, 20 Oct 2023 06:32:16 -0600
mpd: remove extra variable and clear block on failed conn
Diffstat:
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/blocks/mpd.c b/blocks/mpd.c
@@ -39,10 +39,9 @@ mpd_tag(struct Block *b)
struct mpd_status *status = NULL;
const struct mpd_arg *ma = b->arg;
size_t i, len = 0;
- const char *str = "";
if ((!conn && open_conn(ma->host) != 0) || check_conn(ma->host) != 0)
- return snprintf(b->curstr, LEN(b->curstr), b->fmt, str);
+ return 0;
mpd_run_noidle(conn);
@@ -60,7 +59,6 @@ mpd_tag(struct Block *b)
buf + len, sizeof(buf) - len, "%s",
mpd_song_get_tag(song, ma->tags[i], 0));
}
- str = buf;
mpd_song_free(song);
case MPD_STATE_STOP:
default:
@@ -71,5 +69,5 @@ mpd_tag(struct Block *b)
mpd_send_idle(conn);
- return len? snprintf(b->curstr, LEN(b->curstr), b->fmt, str) : 0;
+ return len? snprintf(b->curstr, LEN(b->curstr), b->fmt, buf) : 0;
}