Re: [PATCH] qemu: eliminate nested switch, simplify code

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

 



On 03/28/2012 01:33 PM, Laine Stump wrote:
> qemuBuildHostNetStr had a switch-within-a-switch where both were
> looking at the same variable. This was apparently to take advantage of
> code common to three different cases (while also taking care of some
> code that was different). However, there were only 2 lines common to
> all, one of those can be eliminated by merging it into the
> virAsprintfs that are in each case. On top of that, all the extra
> empty cases cause Coverity complaints (because they are unreachable),
> but absence of the empty cases causes a compile error due to
> "enumeration value not handled in switch".
> 
> The solution is to just make each toplevel case independent, folding
> in the common code to each.
> ---
>  src/qemu/qemu_command.c |   55 ++++++++++++++++++-----------------------------
>  1 files changed, 21 insertions(+), 34 deletions(-)

ACK.

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
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]