[libvirt] [PATCH] cmdNetworkUpdate: Prefer VSH_EXCLUSIVE_OPTIONS over if-else tree
Ján Tomko
jtomko at redhat.com
Mon Feb 22 15:41:11 UTC 2016
On Mon, Feb 22, 2016 at 01:48:14PM +0100, Michal Privoznik wrote:
> We have macros that check and reject mutually exclusive
> parameters to our commands. Use those instead of if-else tree.
>
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
> tools/virsh-network.c | 21 ++++++++-------------
> 1 file changed, 8 insertions(+), 13 deletions(-)
ACK
> diff --git a/tools/virsh-network.c b/tools/virsh-network.c
> index 1ae206a..d0bd7a3 100644
> --- a/tools/virsh-network.c
> +++ b/tools/virsh-network.c
> @@ -907,9 +907,12 @@ cmdNetworkUpdate(vshControl *ctl, const vshCmd *cmd)
> bool current = vshCommandOptBool(cmd, "current");
> bool config = vshCommandOptBool(cmd, "config");
> bool live = vshCommandOptBool(cmd, "live");
> - unsigned int flags = 0;
> + unsigned int flags = VIR_NETWORK_UPDATE_AFFECT_CURRENT;
> const char *affected;
>
> + VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
> + VSH_EXCLUSIVE_OPTIONS_VAR(current, config);
> +
I would rather use VSH_EXCLUSIVE_OPTIONS to get rid of the 'current'
variable.
Jan
More information about the libvir-list
mailing list