helper/options: drop redundant argument checks
In case the option is passed with a single `:` in `optstring` argument, the call to `getopt_long()` should return `?`. Therefore the check on `optarg` is redundand in case of `l` and `c`. Change-Id: I1ac176fdae449a34db0a0496b69a9ea65ccd6aec Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com> Reported-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/8718 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
parent
0b97973bfb
commit
778d2dc4bb
|
@ -303,12 +303,10 @@ int parse_cmdline_args(struct command_context *cmd_ctx, int argc, char *argv[])
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'l': /* --log_output | -l */
|
case 'l': /* --log_output | -l */
|
||||||
if (optarg)
|
command_run_linef(cmd_ctx, "log_output %s", optarg);
|
||||||
command_run_linef(cmd_ctx, "log_output %s", optarg);
|
|
||||||
break;
|
break;
|
||||||
case 'c': /* --command | -c */
|
case 'c': /* --command | -c */
|
||||||
if (optarg)
|
add_config_command(optarg);
|
||||||
add_config_command(optarg);
|
|
||||||
break;
|
break;
|
||||||
default: /* '?' */
|
default: /* '?' */
|
||||||
/* getopt will emit an error message, all we have to do is bail. */
|
/* getopt will emit an error message, all we have to do is bail. */
|
||||||
|
|
Loading…
Reference in New Issue