From 0b3bcb6c7f1bb4a633896b8a9936e498570ef8e1 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 15 Sep 2008 12:27:28 +0200 Subject: const pointers Convert pointers to const whenever it is possible. Fixes all those -Wconst warnings. --- src/options.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/options.c') diff --git a/src/options.c b/src/options.c index 1ecc79103..668fe7522 100644 --- a/src/options.c +++ b/src/options.c @@ -40,13 +40,13 @@ typedef struct { int shortopt; - char *longopt; - char *argument; - char *descrition; + const char *longopt; + const char *argument; + const char *descrition; } arg_opt_t; -typedef void (*option_callback_fn_t)(int c, char *arg); +typedef void (*option_callback_fn_t)(int c, const char *arg); options_t options; @@ -92,7 +92,7 @@ lookup_option(int s, char *l) } static void -option_error(int error, char *option, char *arg) +option_error(int error, const char *option, const char *arg) { switch(error) { @@ -141,7 +141,7 @@ display_help(void) } static void -handle_option(int c, char *arg) +handle_option(int c, const char *arg) { D("option callback -%c %s\n", c, arg); switch(c) @@ -241,7 +241,7 @@ options_parse(int argc, const char *argv[]) i=1; while (i < argc) { - char *arg = (char *) argv[i]; + const char *arg = argv[i]; size_t len = strlen(arg); /* check for a long option */ @@ -351,7 +351,7 @@ options_init( void ) options.crossfade_time = DEFAULT_CROSSFADE_TIME; options.seek_time = 1; options.screen_list = g_strsplit_set(DEFAULT_SCREEN_LIST, " ", 0); - options.timedisplay_type = DEFAULT_TIMEDISPLAY_TYPE; + 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); -- cgit v1.2.3