Commit 8c1cedb4 authored by Taeung Song's avatar Taeung Song Committed by Arnaldo Carvalho de Melo

perf config: Invert an if statement to reduce nesting in cmd_config()

Signed-off-by: default avatarTaeung Song <treeze.taeung@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/1494241650-32210-1-git-send-email-treeze.taeung@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent ec27ae18
...@@ -204,31 +204,33 @@ int cmd_config(int argc, const char **argv) ...@@ -204,31 +204,33 @@ int cmd_config(int argc, const char **argv)
} }
break; break;
default: default:
if (argc) { if (!argc) {
for (i = 0; argv[i]; i++) { usage_with_options(config_usage, config_options);
char *var, *value; break;
char *arg = strdup(argv[i]); }
if (!arg) {
pr_err("%s: strdup failed\n", __func__);
ret = -1;
break;
}
if (parse_config_arg(arg, &var, &value) < 0) { for (i = 0; argv[i]; i++) {
free(arg); char *var, *value;
ret = -1; char *arg = strdup(argv[i]);
break;
}
if (value == NULL) if (!arg) {
ret = show_spec_config(set, var); pr_err("%s: strdup failed\n", __func__);
else ret = -1;
ret = set_config(set, config_filename, var, value); break;
}
if (parse_config_arg(arg, &var, &value) < 0) {
free(arg); free(arg);
ret = -1;
break;
} }
} else
usage_with_options(config_usage, config_options); if (value == NULL)
ret = show_spec_config(set, var);
else
ret = set_config(set, config_filename, var, value);
free(arg);
}
} }
perf_config_set__delete(set); perf_config_set__delete(set);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment