util/nvmutil: clearer intent on struct data

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-06 16:52:02 +00:00
parent 7ae2288c10
commit 9e32456c8c
+7 -7
View File
@@ -100,12 +100,12 @@ static const char rmac[] = "xx:xx:xx:xx:xx:xx";
static const char *fname = ""; static const char *fname = "";
static const char *argv0; static const char *argv0;
struct op { struct commands {
const char *str; const char *str;
void (*cmd)(void); void (*cmd)(void);
int args; int args;
}; };
static const struct op ops[] = { static const struct commands command[] = {
{ "dump", cmd_dump, 3 }, { "dump", cmd_dump, 3 },
{ "setmac", cmd_setmac, 3 }, { "setmac", cmd_setmac, 3 },
{ "swap", cmd_swap, 3 }, { "swap", cmd_swap, 3 },
@@ -234,14 +234,14 @@ set_cmd(int argc, char *argv[])
return; return;
} }
for (i = 0; i < items(ops) && cmd == NULL; i++) { for (i = 0; i < items(command) && cmd == NULL; i++) {
if (strcmp(argv[2], ops[i].str) != 0) if (strcmp(argv[2], command[i].str) != 0)
continue; continue;
if (argc >= ops[i].args) { if (argc >= command[i].args) {
cmd = ops[i].cmd; cmd = command[i].cmd;
break; break;
} }
err(EINVAL, "Too few args: command '%s'", ops[i].str); err(EINVAL, "Too few args: command '%s'", command[i].str);
} }
} }