Code

mpdclient: remove unnecessary NULL check
[ncmpc.git] / src / mpdclient.h
index fb083b9c4fe2cd23d21644cfe85698250b7cca60..84878466d22e7a08bc40f42330502745f4f048e9 100644 (file)
@@ -14,17 +14,27 @@ struct mpdclient {
 
        struct mpd_connection *connection;
 
+       /**
+        * Tracks idle events.  It is automatically called by
+        * mpdclient_get_connection() and mpdclient_put_connection().
+        */
+       struct mpd_glib_source *source;
+
+       struct mpd_status *status;
+       const struct mpd_song *song;
+
        /**
         * This attribute is incremented whenever the connection changes
         * (i.e. on disconnection and (re-)connection).
         */
        unsigned connection_id;
 
+       int volume;
+
        /**
-        * Tracks idle events.  It is automatically called by
-        * mpdclient_get_connection() and mpdclient_put_connection().
+        * A bit mask of idle events occurred since the last update.
         */
-       struct mpd_glib_source *source;
+       enum mpd_idle events;
 
        /**
         * This attribute is true when the connection is currently in
@@ -32,16 +42,10 @@ struct mpdclient {
         */
        bool idle;
 
-       struct mpd_status *status;
-       const struct mpd_song *song;
-
-       int volume;
-       unsigned update_id;
-
        /**
-        * A bit mask of idle events occurred since the last update.
+        * Is MPD currently playing?
         */
-       enum mpd_idle events;
+       bool playing;
 };
 
 enum {
@@ -86,6 +90,17 @@ mpdclient_is_connected(const struct mpdclient *c)
        return c->connection != NULL;
 }
 
+/**
+ * Is this object "dead"?  i.e. not connected and not currently doing
+ * anything to connect.
+ */
+gcc_pure
+static inline bool
+mpdclient_is_dead(const struct mpdclient *c)
+{
+       return c->connection == NULL;
+}
+
 gcc_pure
 static inline bool
 mpdclient_is_playing(const struct mpdclient *c)