]> xenbits.xensource.com Git - libvirt.git/commitdiff
conf: reduce indentation in virDomainDefAddImplicitVideo
authorJán Tomko <jtomko@redhat.com>
Mon, 11 Apr 2016 13:26:06 +0000 (15:26 +0200)
committerJán Tomko <jtomko@redhat.com>
Tue, 12 Apr 2016 08:45:35 +0000 (10:45 +0200)
Return early if there is nothing to do.

src/conf/domain_conf.c

index d7dcc4cb6dadc9b203268a4c11bfed4e7d889a4c..7060199557ed2a706eacf917c5ab93a1cb00b828 100644 (file)
@@ -18650,22 +18650,23 @@ virDomainDefAddImplicitVideo(virDomainDefPtr def)
 
     /* For backwards compatibility, if no <video> tag is set but there
      * is a <graphics> tag, then we add a single video tag */
-    if (def->ngraphics && !def->nvideos) {
-        if (VIR_ALLOC(video) < 0)
-            goto cleanup;
-        video->type = virDomainVideoDefaultType(def);
-        if (video->type < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("cannot determine default video type"));
-            goto cleanup;
-        }
-        video->vram = virDomainVideoDefaultRAM(def, video->type);
-        video->heads = 1;
-        if (VIR_ALLOC_N(def->videos, 1) < 0)
-            goto cleanup;
-        def->videos[def->nvideos++] = video;
-        video = NULL;
+    if (def->ngraphics == 0 || def->nvideos > 0)
+        return 0;
+
+    if (VIR_ALLOC(video) < 0)
+        goto cleanup;
+    video->type = virDomainVideoDefaultType(def);
+    if (video->type < 0) {
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("cannot determine default video type"));
+        goto cleanup;
     }
+    video->vram = virDomainVideoDefaultRAM(def, video->type);
+    video->heads = 1;
+    if (VIR_ALLOC_N(def->videos, 1) < 0)
+        goto cleanup;
+    def->videos[def->nvideos++] = video;
+    video = NULL;
 
     ret = 0;
  cleanup: