From: Erik Skultety Date: Fri, 16 Sep 2016 07:58:24 +0000 (+0200) Subject: vsh: Extract vshCmddefCheckInternals from vshCmddefOptParse X-Git-Tag: v2.3.0-rc1~122 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3a9808b216e871d4ab096f301e40620b01f6d82d;p=thirdparty%2Flibvirt.git 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 --- 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; } }