gui: Parse command line options only once.
authorAndre Noll <maan@systemlinux.org>
Tue, 7 Jan 2014 15:59:27 +0000 (15:59 +0000)
committerAndre Noll <maan@systemlinux.org>
Sun, 4 May 2014 13:48:54 +0000 (15:48 +0200)
There is no point in calling gui_cmdline_parser_ext() when rereading
the configuration since this parser only looks at the command line
options which never change.

Removing the call in com_reread_conf() also allows to get rid of the
global _argc and _argv variables.

gui.c

diff --git a/gui.c b/gui.c
index 96043da05b5f9b602e229f131b5248c7f43d6190..57e922b01afa17410cb83c49c5dbbdf9ee032ce1 100644 (file)
--- a/gui.c
+++ b/gui.c
@@ -84,9 +84,6 @@ struct gui_command {
 
 static struct gui_theme theme;
 
 
 static struct gui_theme theme;
 
-static int _argc;
-static char **_argv;
-
 static void com_help(void);
 static void com_reread_conf(void);
 static void com_enlarge_top_win(void);
 static void com_help(void);
 static void com_reread_conf(void);
 static void com_enlarge_top_win(void);
@@ -1306,7 +1303,6 @@ static void com_reread_conf(void)
                return;
        }
        PARA_INFO_LOG("rereading command line options and config file\n");
                return;
        }
        PARA_INFO_LOG("rereading command line options and config file\n");
-       gui_cmdline_parser_ext(_argc, _argv, &conf, &params);
        /*
         * Despite .print_errors is set to 0, gengetopt will print to stderr
         * anyway, and exit on errors. So we have to shutdown curses first.
        /*
         * Despite .print_errors is set to 0, gengetopt will print to stderr
         * anyway, and exit on errors. So we have to shutdown curses first.
@@ -1462,9 +1458,6 @@ int main(int argc, char *argv[])
        int ret;
        char *cf;
 
        int ret;
        char *cf;
 
-       _argc = argc;
-       _argv = argv;
-
        gui_cmdline_parser(argc, argv, &conf); /* exits on errors */
        loglevel = get_loglevel_by_name(conf.loglevel_arg);
        version_handle_flag("gui", conf.version_given);
        gui_cmdline_parser(argc, argv, &conf); /* exits on errors */
        loglevel = get_loglevel_by_name(conf.loglevel_arg);
        version_handle_flag("gui", conf.version_given);