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

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

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(-)


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

Attachment: signature.asc
Description: OpenPGP digital signature

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