]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
maint: avoid unbalanced {} across vbox #ifdef
authorEric Blake <eblake@redhat.com>
Tue, 18 Mar 2014 20:10:27 +0000 (14:10 -0600)
committerEric Blake <eblake@redhat.com>
Tue, 18 Mar 2014 20:28:05 +0000 (14:28 -0600)
Emacs is fairly good about navigating across function and scope
boundaries, provided that the code has balanced {}.  The vbox
code, however, violated that premise, by splitting 'if () {'
across several #ifdef branches, but sharing the '} else {...}'
outside of the branches.  The extra lines of code is worth my
sanity, in a function that is already a horrendous 1100+ lines
long.

* src/vbox/vbox_tmpl.c (vboxDomainGetXMLDesc) Duplicate code
rather than trying to share else branch across #ifdef.

Signed-off-by: Eric Blake <eblake@redhat.com>
src/vbox/vbox_tmpl.c

index 7162a253541eacba3769d884b5056e4eb0f8492c..2aeddd0473c4ad0097487e891a86e1f0d6932223 100644 (file)
@@ -2649,6 +2649,9 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) {
                             VRDxServer->vtbl->GetPort(VRDxServer, &VRDPport);
                             if (VRDPport) {
                                 def->graphics[def->ngraphics]->data.rdp.port = VRDPport;
+                            } else {
+                                def->graphics[def->ngraphics]->data.rdp.autoport = true;
+                            }
 #elif VBOX_API_VERSION < 4000000 /* 3001000 <= VBOX_API_VERSION < 4000000 */
                             PRUnichar *VRDPport = NULL;
                             VRDxServer->vtbl->GetPorts(VRDxServer, &VRDPport);
@@ -2656,6 +2659,9 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) {
                                 /* even if vbox supports mutilpe ports, single port for now here */
                                 def->graphics[def->ngraphics]->data.rdp.port = PRUnicharToInt(VRDPport);
                                 VBOX_UTF16_FREE(VRDPport);
+                            } else {
+                                def->graphics[def->ngraphics]->data.rdp.autoport = true;
+                            }
 #else /* VBOX_API_VERSION >= 4000000 */
                             PRUnichar *VRDEPortsKey = NULL;
                             PRUnichar *VRDEPortsValue = NULL;
@@ -2666,10 +2672,10 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) {
                                 /* even if vbox supports mutilpe ports, single port for now here */
                                 def->graphics[def->ngraphics]->data.rdp.port = PRUnicharToInt(VRDEPortsValue);
                                 VBOX_UTF16_FREE(VRDEPortsValue);
-#endif /* VBOX_API_VERSION >= 4000000 */
                             } else {
                                 def->graphics[def->ngraphics]->data.rdp.autoport = true;
                             }
+#endif /* VBOX_API_VERSION >= 4000000 */
 
                             def->graphics[def->ngraphics]->type = VIR_DOMAIN_GRAPHICS_TYPE_RDP;