Issue 336 2

These patches consolidate the parse of command line options to ConfigManager.
In addition, it also parses a configuration file.
>> +	if (!g_option_context_parse(optCtx, argc, argv, &error)) {
>> +		MLPL_ERR("Failed to parse command line argment. (%s)\n",
>> +		         error ? error->message : "Unknown reason");

>This NULL check is also needless.

Probably It won't be needed. However, the reference manual of
g_option_context_parse()

explicitly describe the condition in which 'error' is set.

In this situation, the above code is a conservative way, isn't it.


2014-08-12 11:42 GMT+09:00 Kouhei Sutou <notifications@github.com>:

> In server/src/ConfigManager.cc:
>
> > +		 (gpointer)CommandLineOptions::parseFaceRestPort,
> > +		 "Port of FaceRest", NULL},
> > +		{ NULL }
> > +	};
> > +
> > +	GOptionContext *optCtx = g_option_context_new(NULL);
> > +	GOptionGroup *optGrp = g_option_group_new(
> > +	  "ConfigManager", "ConfigManager group", "ConfigManager",
> > +	  cmdLineOpts, NULL);
> > +	g_option_context_set_main_group(optCtx, optGrp);
> > +	//g_option_context_add_group(optCtx, optGrp);
> > +	g_option_context_add_main_entries(optCtx, entries, NULL);
> > +	GError *error = NULL;
> > +	if (!g_option_context_parse(optCtx, argc, argv, &error)) {
> > +		MLPL_ERR("Failed to parse command line argment. (%s)\n",
> > +		         error ? error->message : "Unknown reason");
>
> This NULL check is also needless.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/project-hatohol/hatohol/pull/365/files#r16093221>.
>