ztest: replace shell_fprintf(sh, SHELL_ERROR, ...)
with shell_error
Replace `shell_fprintf(sh, SHELL_ERROR, ...)` with `shell_error(sh, ...)` since it brings the same underlying action with less typing. Note: `shell_error` already concatenates `\n` to format strings, so we remove `\n` from the original code. Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
This commit is contained in:
parent
347c56c600
commit
14c6925596
1 changed files with 4 additions and 6 deletions
|
@ -1285,8 +1285,7 @@ static int cmd_shuffle(const struct shell *sh, size_t argc, char **argv)
|
||||||
case 's':
|
case 's':
|
||||||
val = atoi(state->optarg);
|
val = atoi(state->optarg);
|
||||||
if (val < 1) {
|
if (val < 1) {
|
||||||
shell_fprintf(sh, SHELL_ERROR,
|
shell_error(sh, "Invalid number of suite iterations");
|
||||||
"Invalid number of suite iterations\n");
|
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
suite_iter = val;
|
suite_iter = val;
|
||||||
|
@ -1295,16 +1294,15 @@ static int cmd_shuffle(const struct shell *sh, size_t argc, char **argv)
|
||||||
case 'c':
|
case 'c':
|
||||||
val = atoi(state->optarg);
|
val = atoi(state->optarg);
|
||||||
if (val < 1) {
|
if (val < 1) {
|
||||||
shell_fprintf(sh, SHELL_ERROR,
|
shell_error(sh, "Invalid number of case iterations");
|
||||||
"Invalid number of case iterations\n");
|
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
case_iter = val;
|
case_iter = val;
|
||||||
opt_num++;
|
opt_num++;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
shell_fprintf(sh, SHELL_ERROR, "Invalid option or option usage: %s\n",
|
shell_error(sh, "Invalid option or option usage: %s",
|
||||||
argv[opt_index + 1]);
|
argv[opt_index + 1]);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue