From 3a9808b216e871d4ab096f301e40620b01f6d82d Mon Sep 17 00:00:00 2001 From: Erik Skultety Date: Fri, 16 Sep 2016 09:58:24 +0200 Subject: [PATCH] vsh: Extract vshCmddefCheckInternals from vshCmddefOptParse Originally introduced by commit 2432521e which correctly split vshCmddefOptParse into command's options validation and options parsing. However, command's 'internals' are not tied solely to .options, rather it should be about the overall structure, therefore the validation should be extracted from vshCmddefOptParse and performed only within our test suite, i.e. in vshSelfTest. Signed-off-by: Erik Skultety --- tools/vsh.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tools/vsh.c b/tools/vsh.c index 1d87dfabb9..1cf929424b 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -428,9 +428,6 @@ static int vshCmddefOptParse(const vshCmdDef *cmd, uint64_t *opts_need_arg, uint64_t *opts_required) { - if (vshCmddefCheckInternals(cmd) < 0) - return -1; - if (vshCmddefOptFill(cmd, opts_need_arg, opts_required) < 0) return -1; @@ -3362,7 +3359,7 @@ cmdSelfTest(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED) if (def->flags & VSH_CMD_FLAG_ALIAS) continue; - if (!vshCmddefHelp(ctl, def->name)) + if (vshCmddefCheckInternals(def) < 0) return false; } }