[libvirt] [PATCH 2/2] cmdVcpuPin: Remove dead code
Peter Krempa
pkrempa at redhat.com
Wed Jul 15 07:10:48 UTC 2015
On Wed, Jul 15, 2015 at 09:08:45 +0200, Peter Krempa wrote:
> On Tue, Jul 14, 2015 at 16:37:01 +0200, Michal Privoznik wrote:
> > There's this condition:
> >
> > flags & VIR_DOMAIN_AFFECT_CURRENT && virDomainIsActive(dom)
> >
> > which can never be true since VIR_DOMAIN_AFFECT_CURRENT has hardcoded
> > value of zero. Therefore virDomainIsActive() is a dead code. However,
> > the condition could make sense if it is rewritten as the following:
> >
> > !(flags & VIR_DOMAIN_AFFECT_CONFIG) && virDomainIsActive(dom)
> >
> > Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> > ---
> > tools/virsh-domain.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
> > index ac04ded..f7edeeb 100644
> > --- a/tools/virsh-domain.c
> > +++ b/tools/virsh-domain.c
> > @@ -6499,7 +6499,7 @@ cmdVcpuPin(vshControl *ctl, const vshCmd *cmd)
> >
> > if (got_vcpu && vcpu >= ncpus) {
> > if (flags & VIR_DOMAIN_AFFECT_LIVE ||
> > - (flags & VIR_DOMAIN_AFFECT_CURRENT &&
> > + (!(flags & VIR_DOMAIN_AFFECT_CONFIG) &&
^^^^^^
Erm, never mind.
>
> This still is dead code since VIR_DOMAIN_AFFECT_CONFIG is 0. If you mask
> it with any flags you'll get 0, then invert it, it's always true.
>
> Peter
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150715/2b1eef09/attachment-0001.sig>
More information about the libvir-list
mailing list