From 51cb2863dd7def8505ba37bdbcb8221416c26f55 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 17 Sep 2008 12:05:02 +0200 Subject: replaced get_screen_X() with static screen_functions variable Compile time initialization saves resources, compared to run-time initialization. Declare all screen_function structs as global variables, and remove all get functions. --- src/screen_lyrics.c | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) (limited to 'src/screen_lyrics.c') diff --git a/src/screen_lyrics.c b/src/screen_lyrics.c index 2f63fb0ae..885a35a76 100644 --- a/src/screen_lyrics.c +++ b/src/screen_lyrics.c @@ -376,23 +376,17 @@ lyrics_lw(void) return lw; } -screen_functions_t * -get_screen_lyrics(void) -{ - static screen_functions_t functions; - - memset(&functions, 0, sizeof(screen_functions_t)); - functions.init = lyrics_screen_init; - functions.exit = lyrics_exit; - functions.open = lyrics_open; - functions.close = NULL; - functions.resize = lyrics_resize; - functions.paint = lyrics_paint; - functions.update = lyrics_update; - functions.cmd = lyrics_cmd; - functions.get_lw = lyrics_lw; - functions.get_title = lyrics_title; - - return &functions; -} +const struct screen_functions screen_lyrics = { + .init = lyrics_screen_init, + .exit = lyrics_exit, + .open = lyrics_open, + .close = NULL, + .resize = lyrics_resize, + .paint = lyrics_paint, + .update = lyrics_update, + .cmd = lyrics_cmd, + .get_lw = lyrics_lw, + .get_title = lyrics_title, +}; + #endif /* ENABLE_LYRICS_SCREEN */ -- cgit v1.2.3