Re: [PATCH] cmdNetworkUpdate: Prefer VSH_EXCLUSIVE_OPTIONS over if-else tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
> ---
>  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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]