]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
tests: vmx: remove pointless labels
authorJán Tomko <jtomko@redhat.com>
Sat, 4 Sep 2021 20:39:27 +0000 (22:39 +0200)
committerJán Tomko <jtomko@redhat.com>
Thu, 9 Sep 2021 16:06:13 +0000 (18:06 +0200)
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
tests/vmx2xmltest.c
tests/xml2vmxtest.c

index b7f232eb7738dac1eef653c6dfb003cf2ba42f91..98b34c9f672bd9b5e9805d55da5ba1348f699cdb 100644 (file)
@@ -68,7 +68,6 @@ testCapsInit(void)
 static int
 testCompareFiles(const char *vmx, const char *xml, bool should_fail_parse)
 {
-    int ret = -1;
     g_autofree char *vmxData = NULL;
     g_autofree char *formatted = NULL;
     g_autoptr(virDomainDef) def = NULL;
@@ -79,31 +78,27 @@ testCompareFiles(const char *vmx, const char *xml, bool should_fail_parse)
     def = virVMXParseConfig(&ctx, xmlopt, caps, vmxData);
     if (should_fail_parse) {
         if (!def)
-            ret = 0;
-        else
-            VIR_TEST_DEBUG("passed instead of expected failure");
-        goto cleanup;
+            return 0;
+
+        VIR_TEST_DEBUG("passed instead of expected failure");
+        return -1;
     }
     if (!def)
-        goto cleanup;
+        return -1;
 
     if (!virDomainDefCheckABIStability(def, def, xmlopt)) {
         fprintf(stderr, "ABI stability check failed on %s", vmx);
-        goto cleanup;
+        return -1;
     }
 
     if (!(formatted = virDomainDefFormat(def, xmlopt,
                                          VIR_DOMAIN_DEF_FORMAT_SECURE)))
-        goto cleanup;
+        return -1;
 
     if (virTestCompareToFile(formatted, xml) < 0)
-        goto cleanup;
-
-    ret = 0;
-
- cleanup:
+        return -1;
 
-    return ret;
+    return 0;
 }
 
 struct testInfo {
index 8a03237b1695dcccc8a891b668b11fe2164085a6..60185746a87305cbfc4fe017d70dd429e8444c51 100644 (file)
@@ -70,7 +70,6 @@ testCapsInit(void)
 static int
 testCompareFiles(const char *xml, const char *vmx, int virtualHW_version)
 {
-    int result = -1;
     g_autofree char *formatted = NULL;
     g_autoptr(virDomainDef) def = NULL;
 
@@ -78,25 +77,21 @@ testCompareFiles(const char *xml, const char *vmx, int virtualHW_version)
                                 VIR_DOMAIN_DEF_PARSE_INACTIVE);
 
     if (def == NULL)
-        goto failure;
+        return -1;
 
     if (!virDomainDefCheckABIStability(def, def, xmlopt)) {
         fprintf(stderr, "ABI stability check failed on %s", xml);
-        goto failure;
+        return -1;
     }
 
     formatted = virVMXFormatConfig(&ctx, xmlopt, def, virtualHW_version);
     if (formatted == NULL)
-        goto failure;
+        return -1;
 
     if (virTestCompareToFile(formatted, vmx) < 0)
-        goto failure;
+        return -1;
 
-    result = 0;
-
- failure:
-
-    return result;
+    return 0;
 }
 
 struct testInfo {