From: Max Kellermann Date: Fri, 17 Mar 2017 22:18:56 +0000 (+0100) Subject: mpdclient: move code to mpdclient_status_free() X-Git-Tag: v0.26~52 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=25fe79b937f82140a394c1179083216798b6364d;p=ncmpc.git mpdclient: move code to mpdclient_status_free() --- diff --git a/src/mpdclient.c b/src/mpdclient.c index 2ae91b4..e1aee1c 100644 --- a/src/mpdclient.c +++ b/src/mpdclient.c @@ -118,6 +118,16 @@ mpdclient_free(struct mpdclient *c) g_free(c); } +static void +mpdclient_status_free(struct mpdclient *c) +{ + if (c->status == NULL) + return; + + mpd_status_free(c->status); + c->status = NULL; +} + void mpdclient_disconnect(struct mpdclient *c) { @@ -133,9 +143,7 @@ mpdclient_disconnect(struct mpdclient *c) } c->connection = NULL; - if (c->status) - mpd_status_free(c->status); - c->status = NULL; + mpdclient_status_free(c); playlist_clear(&c->playlist); @@ -194,8 +202,7 @@ mpdclient_update(struct mpdclient *c) return false; /* free the old status */ - if (c->status) - mpd_status_free(c->status); + mpdclient_status_free(c); /* retrieve new status */ c->status = mpd_run_status(connection);