mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-30 17:18:21 +03:00
lvmcmdline: use known lvm_command_enum
lvm command is already decoded (when found), so use lvm_command_enum directly and avoid comparing all strings again...
This commit is contained in:
parent
5173b0c222
commit
38d34dbe75
@ -1637,21 +1637,20 @@ static struct command *_find_command(struct cmd_context *cmd, const char *path,
|
||||
int opt_enum, opt_i;
|
||||
int accepted, count;
|
||||
int variants = 0;
|
||||
uint16_t lvm_command_enum = (cmd->cname) ? cmd->cname->lvm_command_enum : LVM_COMMAND_COUNT;
|
||||
|
||||
name = last_path_component(path);
|
||||
|
||||
/* factor_common_options() is only for usage, so cname->variants is not set. */
|
||||
for (i = 0; i < COMMAND_COUNT; i++) {
|
||||
if (strcmp(name, commands[i].name))
|
||||
continue;
|
||||
for (i = 0; i < COMMAND_COUNT; i++)
|
||||
if (lvm_command_enum == commands[i].lvm_command_enum)
|
||||
variants++;
|
||||
}
|
||||
|
||||
if (arg_is_set(cmd, type_ARG))
|
||||
type_arg = arg_str_value(cmd, type_ARG, "");
|
||||
|
||||
for (i = 0; i < COMMAND_COUNT; i++) {
|
||||
if (strcmp(name, commands[i].name))
|
||||
if (lvm_command_enum != commands[i].lvm_command_enum)
|
||||
continue;
|
||||
|
||||
if (variants == 1)
|
||||
|
Loading…
Reference in New Issue
Block a user