Introduction
Introduction Statistics Contact Development Disclaimer Help
tRemove ret variable - spoon - dwm status utility (2f30 fork)
git clone git://src.adamsgaard.dk/spoon
Log
Files
Refs
LICENSE
---
commit 9c3041c149f39a124f71e940fc6f84a505e60050
parent a1083a672848a04e871ce0e8ad96c367e55549e5
Author: sin <[email protected]>
Date: Mon, 26 Sep 2016 16:53:17 +0100
Remove ret variable
Diffstat:
M spoon.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
---
diff --git a/spoon.c b/spoon.c
t@@ -47,25 +47,20 @@ mpdread(char *buf, size_t len)
static struct mpd_connection *conn;
struct mpd_song *song;
const char *artist, *title, *name;
- int ret = 0;
if (conn == NULL) {
conn = mpd_connection_new(NULL, 0, 0);
if (conn == NULL)
return -1;
- if (mpd_connection_get_error(conn) != MPD_ERROR_SUCCESS) {
- ret = -1;
+ if (mpd_connection_get_error(conn) != MPD_ERROR_SUCCESS)
goto out;
- }
}
mpd_send_current_song(conn);
song = mpd_recv_song(conn);
/* if no song is playing, reuse connection next time */
if (song == NULL) {
- if (mpd_connection_get_error(conn) != MPD_ERROR_SUCCESS) {
- ret = -1;
+ if (mpd_connection_get_error(conn) != MPD_ERROR_SUCCESS)
goto out;
- }
return -1;
}
artist = mpd_song_get_tag(song, MPD_TAG_ARTIST, 0);
t@@ -78,22 +73,19 @@ mpdread(char *buf, size_t len)
name = mpd_song_get_uri(song);
if (name == NULL) {
mpd_song_free(song);
- ret = -1;
goto out;
}
strlcpy(buf, name, len);
}
mpd_song_free(song);
- if (!mpd_response_finish(conn)) {
- ret = -1;
+ if (!mpd_response_finish(conn))
goto out;
- }
return 0;
out:
warnx("failed to talk to mpd");
mpd_connection_free(conn);
conn = NULL;
- return ret;
+ return -1;
}
#ifdef __OpenBSD__
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.