qemu: eliminate nested switch, simplify code
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.
Showing
想要评论请 注册 或 登录