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:
Evgeniy Naydanov 2025-01-17 18:03:40 +03:00 committed by Antonio Borneo
parent 0b97973bfb
commit 778d2dc4bb
1 changed files with 2 additions and 4 deletions

View File

@ -303,11 +303,9 @@ int parse_cmdline_args(struct command_context *cmd_ctx, int argc, char *argv[])
break;
}
case 'l': /* --log_output | -l */
if (optarg)
command_run_linef(cmd_ctx, "log_output %s", optarg);
break;
case 'c': /* --command | -c */
if (optarg)
add_config_command(optarg);
break;
default: /* '?' */