aboutsummaryrefslogtreecommitdiffstats
path: root/src/screen_list.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-09-25 21:21:00 +0200
committerMax Kellermann <max@duempel.org>2008-09-25 21:21:00 +0200
commit9791d3094719f1ed6c3c8ecf9c006b81d0de5370 (patch)
treea69a352e00ffa1abdfc7d26c01a724dedb5a5af9 /src/screen_list.c
parent3809e2f13bb6642d3a874c24df7d854aa0aea8b5 (diff)
downloadmpd-9791d3094719f1ed6c3c8ecf9c006b81d0de5370.tar.gz
mpd-9791d3094719f1ed6c3c8ecf9c006b81d0de5370.tar.xz
mpd-9791d3094719f1ed6c3c8ecf9c006b81d0de5370.zip
screen: pass screen_functions pointer to switch_screen_mode()
Trying to get rid of the screen ids. A pointer to screen_functions is better for identifying a screen.
Diffstat (limited to '')
-rw-r--r--src/screen_list.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/src/screen_list.c b/src/screen_list.c
index 46e624418..76ae8b155 100644
--- a/src/screen_list.c
+++ b/src/screen_list.c
@@ -86,14 +86,6 @@ screen_list_resize(unsigned cols, unsigned rows)
}
}
-int
-screen_get_id_by_index(unsigned i)
-{
- assert(i < NUM_SCREENS);
-
- return screens[i].id;
-}
-
const char *
screen_get_name(unsigned i)
{
@@ -102,16 +94,16 @@ screen_get_name(unsigned i)
return screens[i].name;
}
-int
-screen_get_id(const char *name)
+const struct screen_functions *
+screen_lookup_name(const char *name)
{
unsigned i;
for (i = 0; i < NUM_SCREENS; ++i)
if (strcmp(name, screens[i].name) == 0)
- return screens[i].id;
+ return screens[i].functions;
- return -1;
+ return NULL;
}
const struct screen_functions *
@@ -123,12 +115,12 @@ screen_get_functions(unsigned i)
}
int
-lookup_mode(int id)
+lookup_mode(const struct screen_functions *sf)
{
unsigned i;
for (i = 0; i < NUM_SCREENS; ++i)
- if (screens[i].id == id)
+ if (screens[i].functions == sf)
return i;
return -1;