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_keydef.c | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) (limited to 'src/screen_keydef.c') diff --git a/src/screen_keydef.c b/src/screen_keydef.c index 44c84ca42..1fde75d45 100644 --- a/src/screen_keydef.c +++ b/src/screen_keydef.c @@ -368,25 +368,17 @@ keydef_lw(void) return lw; } -screen_functions_t * -get_screen_keydef(void) -{ - static screen_functions_t functions; - - memset(&functions, 0, sizeof(screen_functions_t)); - functions.init = keydef_init; - functions.exit = keydef_exit; - functions.open = keydef_open; - functions.close = keydef_close; - functions.resize = keydef_resize; - functions.paint = keydef_paint; - functions.update = keydef_update; - functions.cmd = keydef_cmd; - functions.get_lw = keydef_lw; - functions.get_title = keydef_title; - - return &functions; -} - +const struct screen_functions screen_keydef = { + .init = keydef_init, + .exit = keydef_exit, + .open = keydef_open, + .close = keydef_close, + .resize = keydef_resize, + .paint = keydef_paint, + .update = keydef_update, + .cmd = keydef_cmd, + .get_lw = keydef_lw, + .get_title = keydef_title, +}; #endif -- cgit v1.2.3