misc: remove superfluous null pointer checks for optarg

This is only needed for optional arguments.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
This commit is contained in:
Ruediger Meier 2017-06-21 03:01:30 +02:00
parent 619081cdab
commit 0caad87fdb
3 changed files with 7 additions and 12 deletions

View File

@ -235,8 +235,6 @@ static void parse_argv(int argc, char **argv, struct sinfo *pinfo)
print_shells();
exit(EXIT_SUCCESS);
case 's':
if (!optarg)
usage(stderr);
pinfo->shell = optarg;
break;
default:

View File

@ -1381,15 +1381,12 @@ int main(int argc, char *argv[])
outmode = OUT_NEWLINE;
break;
case 'o':
if (optarg) {
if (*optarg == '=')
optarg++;
ncolumns = string_to_idarray(optarg,
columns, ARRAY_SIZE(columns),
column_name_to_id);
if (ncolumns < 0)
return EXIT_FAILURE;
}
if (*optarg == '=')
optarg++;
ncolumns = string_to_idarray(optarg, columns,
ARRAY_SIZE(columns), column_name_to_id);
if (ncolumns < 0)
return EXIT_FAILURE;
opt_o = 1;
break;
case 'r':

View File

@ -107,7 +107,7 @@ parse_args(int argc, char **argv, struct hexdump *hex)
case 'f':
addfile(optarg, hex);
break;
case 'L':
case 'L':
colormode = UL_COLORMODE_AUTO;
if (optarg)
colormode = colormode_or_err(optarg,