[libvirt] [PATCH] qemu: Resolve Coverity DEADCODE

Peter Krempa pkrempa at redhat.com
Mon Apr 27 11:42:43 UTC 2015


On Mon, Apr 27, 2015 at 07:33:06 -0400, John Ferlan wrote:
> Coverity notes taht the switch() used to check 'connected' values has
> two DEADCODE paths (_DEFAULT & _LAST).  Since 'connected' is a boolean
> it can only be one or the other (CONNECTED or DISCONNECTED), so it just
> seems pointless to use a switch to get "all" values.  Convert to if-else

Well, if you add a new state to the VIR_DOMAIN_CHR_DEVICE_STATE_* enum,
the compiler won't warn you that you need to check yet another place if
you use the if-else statement. That is the exact reason to use switch here.

I hate coverity for this and I hope it will not bite me once I'll have
to touch the code.

Against-will ACK.

Peter
-------------- 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/20150427/d5277a70/attachment-0001.sig>


More information about the libvir-list mailing list