diff options
author | Max Kellermann <max@duempel.org> | 2008-09-17 12:06:14 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-09-17 12:06:14 +0200 |
commit | c98908f6db5ef29a15a98b0dbc756dc24c8ef38a (patch) | |
tree | 6ba7fde64ec8cdd0586b72b53afea9c68a0d1c7e /src/screen.c | |
parent | f77633603554027557b6ef09fea624236fdeaf71 (diff) | |
download | mpd-c98908f6db5ef29a15a98b0dbc756dc24c8ef38a.tar.gz mpd-c98908f6db5ef29a15a98b0dbc756dc24c8ef38a.tar.xz mpd-c98908f6db5ef29a15a98b0dbc756dc24c8ef38a.zip |
screen: moved code to find_configured_screen()
Diffstat (limited to 'src/screen.c')
-rw-r--r-- | src/screen.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/screen.c b/src/screen.c index 797eae2ac..91b4c26a1 100644 --- a/src/screen.c +++ b/src/screen.c @@ -160,23 +160,26 @@ switch_screen_mode(gint id, mpdclient_t *c) mode_fn->open(screen, c); } +static int +find_configured_screen(const char *name) +{ + unsigned i; + + for (i = 0; options.screen_list[i] != NULL; ++i) + if (strcmp(options.screen_list[i], name) == 0) + return i; + + return -1; +} + static void screen_next_mode(mpdclient_t *c, int offset) { int max = g_strv_length(options.screen_list); int current, next; - int i; /* find current screen */ - current = -1; - i = 0; - while (options.screen_list[i]) { - if (strcmp(options.screen_list[i], - screens[screen->mode].name) == 0) - current = i; - i++; - } - + current = find_configured_screen(screens[screen->mode].name); next = current + offset; if (next<0) next = max-1; |