Code

mpdclient: move aconnect_start() call to a separate function
authorMax Kellermann <max.kellermann@gmail.com>
Sat, 25 Mar 2017 19:53:35 +0000 (20:53 +0100)
committerMax Kellermann <max.kellermann@gmail.com>
Sat, 25 Mar 2017 19:53:35 +0000 (20:53 +0100)
src/mpdclient.c

index 8c18a0c81ab60044db6df587af04e87abc3d2e46..870839fd27dbb69ee8abd1d4b65e79d8c8567ee4 100644 (file)
@@ -345,6 +345,16 @@ static const struct aconnect_handler mpdclient_connect_handler = {
        .error = mpdclient_connect_error,
 };
 
+static void
+mpdclient_aconnect_start(struct mpdclient *c,
+                        const struct mpd_settings *settings)
+{
+       aconnect_start(&c->async_connect,
+                      mpd_settings_get_host(settings),
+                      mpd_settings_get_port(settings),
+                      &mpdclient_connect_handler, c);
+}
+
 #endif
 
 void
@@ -354,10 +364,7 @@ mpdclient_connect(struct mpdclient *c)
        mpdclient_disconnect(c);
 
 #ifdef ENABLE_ASYNC_CONNECT
-       aconnect_start(&c->async_connect,
-                      mpd_settings_get_host(c->settings),
-                      mpd_settings_get_port(c->settings),
-                      &mpdclient_connect_handler, c);
+       mpdclient_aconnect_start(c, c->settings);
 #else
        /* connect to MPD */
        struct mpd_connection *connection =