diff options
author | Max Kellermann <max@duempel.org> | 2008-11-07 08:29:23 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-11-07 08:29:23 +0100 |
commit | c7a5ac5c3656074b78d826479959cb7425efadcd (patch) | |
tree | 6583c57bdc3142e6d33b19dcb651cdff1d256b46 | |
parent | ae97bd3437baba458be2eec8a57eb5eece63d005 (diff) | |
download | mpd-c7a5ac5c3656074b78d826479959cb7425efadcd.tar.gz mpd-c7a5ac5c3656074b78d826479959cb7425efadcd.tar.xz mpd-c7a5ac5c3656074b78d826479959cb7425efadcd.zip |
options: static initialization if possible
Initialize the options struct statically.
-rw-r--r-- | src/options.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/options.c b/src/options.c index 1b745bb76..853f10545 100644 --- a/src/options.c +++ b/src/options.c @@ -45,7 +45,17 @@ typedef struct { typedef void (*option_callback_fn_t)(int c, const char *arg); -options_t options; +options_t options = { + .port = DEFAULT_PORT, + .crossfade_time = DEFAULT_CROSSFADE_TIME, + .seek_time = 1, + .lyrics_timeout = DEFAULT_LYRICS_TIMEOUT, + .find_wrap = true, + .wide_cursor = true, + .audible_bell = true, + .scroll = DEFAULT_SCROLL, + .welcome_screen_list = true, +}; static const arg_opt_t option_table[] = { { '?', "help", NULL, "Show this help message" }, @@ -331,21 +341,11 @@ options_init(void) /* get initial values for port from MPD_PORT (enviroment) */ if ((value = g_getenv(MPD_PORT_ENV))) options.port = atoi(value); - else - options.port = DEFAULT_PORT; /* default option values */ options.list_format = g_strdup(DEFAULT_LIST_FORMAT); options.status_format = g_strdup(DEFAULT_STATUS_FORMAT); - options.find_wrap = true; - options.wide_cursor = true; - options.welcome_screen_list = true; - options.audible_bell = true; - options.crossfade_time = DEFAULT_CROSSFADE_TIME; - options.seek_time = 1; options.screen_list = g_strsplit_set(DEFAULT_SCREEN_LIST, " ", 0); options.timedisplay_type = g_strdup(DEFAULT_TIMEDISPLAY_TYPE); - options.lyrics_timeout = DEFAULT_LYRICS_TIMEOUT; - options.scroll = DEFAULT_SCROLL; options.scroll_sep = g_strdup(DEFAULT_SCROLL_SEP); } |