diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-03-07 00:08:17 +0000 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-03-07 00:08:17 +0000 |
| commit | 658ed55bc12b9bd52b7982c7004af88afbd1f215 (patch) | |
| tree | e964789b0e4817557150e2c581cee2da6302cda0 /util/nvmutil/nvmutil.c | |
| parent | 330b2da20c1253f83d822b169e03da250727b916 (diff) | |
util/nvmutil: tidy up conv_argv_part_num
no need for strlen here (1-character string).
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/nvmutil/nvmutil.c')
| -rw-r--r-- | util/nvmutil/nvmutil.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index 3e1ac3c2..294f12f3 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -277,9 +277,6 @@ check_cmd_args(int argc, char *argv[]) err(EINVAL, "Bad command"); } -/* - * Not to be confused with check_part_num() - */ static size_t conv_argv_part_num(const char *part_str) { @@ -290,12 +287,10 @@ conv_argv_part_num(const char *part_str) * it is assumed to be signed, and handled accordingly. */ - if (strlen(part_str) != 1) - err(EINVAL, "Partnum string '%s' wrong length.", - part_str); + if (part_str[0] == '\0' || part_str[1] != '\0') + err(EINVAL, "Partnum string '%s' wrong length.", part_str); - ch = (unsigned char)part_str[0]; - ch -= '0'; + ch = (unsigned char)part_str[0] - '0'; check_part_num((size_t)ch); return (size_t)ch; @@ -887,9 +882,6 @@ set_part_modified(size_t p) part_modified[p] = 1; } -/* - * Not to be confused with conv_argv_part_num() - */ static void check_part_num(size_t p) { |
