Skip to content

Commit 778d2dc

Browse files
en-scborneoa
authored andcommitted
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 <[email protected]> Reported-by: Antonio Borneo <[email protected]> Reviewed-on: https://review.openocd.org/c/openocd/+/8718 Tested-by: jenkins Reviewed-by: Antonio Borneo <[email protected]>
1 parent 0b97973 commit 778d2dc

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/helper/options.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,12 +303,10 @@ int parse_cmdline_args(struct command_context *cmd_ctx, int argc, char *argv[])
303303
break;
304304
}
305305
case 'l': /* --log_output | -l */
306-
if (optarg)
307-
command_run_linef(cmd_ctx, "log_output %s", optarg);
306+
command_run_linef(cmd_ctx, "log_output %s", optarg);
308307
break;
309308
case 'c': /* --command | -c */
310-
if (optarg)
311-
add_config_command(optarg);
309+
add_config_command(optarg);
312310
break;
313311
default: /* '?' */
314312
/* getopt will emit an error message, all we have to do is bail. */

0 commit comments

Comments
 (0)