Code

screen: eliminated state macros
authorMax Kellermann <max@duempel.org>
Thu, 1 Oct 2009 20:03:33 +0000 (22:03 +0200)
committerMax Kellermann <max@duempel.org>
Thu, 1 Oct 2009 20:03:33 +0000 (22:03 +0200)
Better do it manually.

src/main.c
src/player_command.c
src/screen.c
src/screen.h
src/screen_play.c

index a03b707d4f47a33809bd4a874ab646573bebe240..43e0dd7a3d2db19a883b5834008260f5ca3a569e 100644 (file)
@@ -81,7 +81,7 @@ update_xterm_title(void)
        }
 
        if (options.xterm_title_format && status && song &&
-           IS_PLAYING(mpd_status_get_state(status)))
+           mpd_status_get_state(status) == MPD_STATE_PLAY)
                strfsong(tmp, BUFSIZE, options.xterm_title_format, song);
        else
                g_strlcpy(tmp, PACKAGE " version " VERSION, BUFSIZE);
index 085ffa14a478f0eba1f211954b7fd3653369c59d..3d6d75ab3c40ed3a27713d7013a3a9db2d18cae3 100644 (file)
@@ -24,8 +24,6 @@
 #include "i18n.h"
 #include "screen_client.h"
 
-#define IS_PAUSED(s) (s==MPD_STATE_PAUSE)
-
 int seek_id = -1;
 int seek_target_time;
 
@@ -93,7 +91,7 @@ handle_player_command(struct mpdclient *c, command_t cmd)
                */
        case CMD_PAUSE:
                if (!mpd_run_pause(c->connection,
-                                  !IS_PAUSED(mpd_status_get_state(c->status))))
+                                  mpd_status_get_state(c->status) != MPD_STATE_PAUSE))
                        mpdclient_handle_error(c);
                break;
        case CMD_STOP:
index cf995383cf361dc0dae0f14e0b517f46ed44675d..f988cb09208d1168dbc74070efd1420e96f5f81e 100644 (file)
@@ -170,7 +170,8 @@ paint_progress_window(struct mpdclient *c)
                elapsed = 0;
 
        duration = c->status != NULL &&
-               !IS_STOPPED(mpd_status_get_state(c->status))
+               (mpd_status_get_state(c->status) == MPD_STATE_PLAY ||
+                mpd_status_get_state(c->status) == MPD_STATE_PAUSE)
                ? mpd_status_get_total_time(c->status)
                : 0;
 
index 17fc3d46d14691b7a27c30a9fc7db2ee0b2f89e5..5ed300fa67551d4cad85127e4558a20bd71cc4dc 100644 (file)
 #include <ncurses.h>
 #endif
 
-#define IS_PLAYING(s) (s==MPD_STATE_PLAY)
-#define IS_PAUSED(s) (s==MPD_STATE_PAUSE)
-#define IS_STOPPED(s) (!(IS_PLAYING(s) | IS_PAUSED(s)))
-
 #define MAX_SONGNAME_LENGTH   512
 
 struct mpdclient;
index ceb13616662197b076a0316e9fdfbb3dc735a971..f1af5196f76a0ff572201f38f1e24662ab0a6194 100644 (file)
@@ -570,7 +570,8 @@ play_update(struct mpdclient *c)
                playlist_restore_selection();
 
        current_song_id = c->status != NULL &&
-               !IS_STOPPED(mpd_status_get_state(c->status))
+               (mpd_status_get_state(c->status) == MPD_STATE_PLAY ||
+                mpd_status_get_state(c->status) == MPD_STATE_PAUSE)
                ? (int)mpd_status_get_song_id(c->status) : -1;
 
        if (current_song_id != prev_song_id) {