Code

mpdclient.h: fix the spelling of "occurred"
[ncmpc.git] / src / mpdclient.h
index 8309aa3a30519869c3f16af90c7c9bf5879ad219..383634fb78398c2e10726ca88d3acc7f03e4cb19 100644 (file)
@@ -36,7 +36,7 @@ struct mpdclient {
        unsigned update_id;
 
        /**
-        * A bit mask of idle events occured since the last update.
+        * A bit mask of idle events occurred since the last update.
         */
        enum mpd_idle events;
 };
@@ -57,12 +57,19 @@ mpdclient_is_connected(const struct mpdclient *c)
        return c->connection != NULL;
 }
 
+G_GNUC_PURE
+static inline bool
+mpdclient_is_playing(const struct mpdclient *c)
+{
+       return c->status != NULL &&
+               (mpd_status_get_state(c->status) == MPD_STATE_PLAY ||
+                mpd_status_get_state(c->status) == MPD_STATE_PAUSE);
+}
+
 static inline const struct mpd_song *
 mpdclient_get_current_song(const struct mpdclient *c)
 {
-       return c->song != NULL && c->status != NULL &&
-               (mpd_status_get_state(c->status) == MPD_STATE_PLAY ||
-                mpd_status_get_state(c->status) == MPD_STATE_PAUSE)
+       return c->song != NULL && mpdclient_is_playing(c)
                ? c->song
                : NULL;
 }