mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 19:45:21 +00:00
vsh: discard vshCmddefOptFill and move its body to vshCmddefOptParse
Recent changes extracted the command internals validation routine from vshCmddefOptParse method which now just calls vshCmddefOptFill. Therefore, make vshCmddefOptFill the new vshCmddefOptParse and drop the unnecessary name. Signed-off-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
3a9808b216
commit
45a739038d
25
tools/vsh.c
25
tools/vsh.c
@ -378,10 +378,15 @@ vshCmddefCheckInternals(const vshCmdDef *cmd)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Keeps track of options that are required or need and argument */
|
||||
/* Parse the options associated with @cmd, i.e. test whether options are
|
||||
* required or need an argument.
|
||||
*
|
||||
* Returns -1 on error or 0 on success, filling the caller-provided bitmaps
|
||||
* which keep track of required options and options needing an argument.
|
||||
*/
|
||||
static int
|
||||
vshCmddefOptFill(const vshCmdDef *cmd, uint64_t *opts_need_arg,
|
||||
uint64_t *opts_required)
|
||||
vshCmddefOptParse(const vshCmdDef *cmd, uint64_t *opts_need_arg,
|
||||
uint64_t *opts_required)
|
||||
{
|
||||
size_t i;
|
||||
bool optional = false;
|
||||
@ -420,16 +425,6 @@ vshCmddefOptFill(const vshCmdDef *cmd, uint64_t *opts_need_arg,
|
||||
optional = true;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Validate that the options associated with cmd can be parsed. */
|
||||
static int
|
||||
vshCmddefOptParse(const vshCmdDef *cmd, uint64_t *opts_need_arg,
|
||||
uint64_t *opts_required)
|
||||
{
|
||||
if (vshCmddefOptFill(cmd, opts_need_arg, opts_required) < 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -2713,8 +2708,8 @@ vshReadlineParse(const char *text, int state)
|
||||
goto error;
|
||||
cmd_exists = true;
|
||||
|
||||
if (vshCmddefOptFill(cmd, &const_opts_need_arg,
|
||||
&const_opts_required) < 0)
|
||||
if (vshCmddefOptParse(cmd, &const_opts_need_arg,
|
||||
&const_opts_required) < 0)
|
||||
goto error;
|
||||
opts_need_arg = const_opts_need_arg;
|
||||
opts_seen = const_opts_seen;
|
||||
|
Loading…
Reference in New Issue
Block a user