]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: Refactor control flow in testBackingXMLjsonXML
authorPeter Krempa <pkrempa@redhat.com>
Fri, 8 Mar 2019 15:11:20 +0000 (16:11 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 20 Mar 2019 07:17:05 +0000 (08:17 +0100)
Get rid of the 'cleanup' label.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
tests/qemublocktest.c

index 9e4af075b7973910312e2d04250be5cf3b043af0..becd31a0ad68064d98b039c8c268499cfd9ade11 100644 (file)
@@ -51,7 +51,6 @@ testBackingXMLjsonXML(const void *args)
     VIR_AUTOFREE(char *) propsstr = NULL;
     VIR_AUTOFREE(char *) protocolwrapper = NULL;
     VIR_AUTOFREE(char *) actualxml = NULL;
-    int ret = -1;
     VIR_AUTOUNREF(virStorageSourcePtr) xmlsrc = NULL;
     VIR_AUTOUNREF(virStorageSourcePtr) jsonsrc = NULL;
 
@@ -61,36 +60,36 @@ testBackingXMLjsonXML(const void *args)
     xmlsrc->type = data->type;
 
     if (!(xml = virXMLParseStringCtxt(data->xml, "(test storage source XML)", &ctxt)))
-        goto cleanup;
+        return -1;
 
     if (virDomainDiskSourceParse(ctxt->node, ctxt, xmlsrc, 0, NULL) < 0) {
         fprintf(stderr, "failed to parse disk source xml\n");
-        goto cleanup;
+        return -1;
     }
 
     if (!(backendprops = qemuBlockStorageSourceGetBackendProps(xmlsrc, true))) {
         fprintf(stderr, "failed to format disk source json\n");
-        goto cleanup;
+        return -1;
     }
 
     if (virJSONValueObjectCreate(&wrapper, "a:file", &backendprops, NULL) < 0)
-        goto cleanup;
+        return -1;
 
     if (!(propsstr = virJSONValueToString(wrapper, false)))
-        goto cleanup;
+        return -1;
 
     if (virAsprintf(&protocolwrapper, "json:%s", propsstr) < 0)
-        goto cleanup;
+        return -1;
 
     if (!(jsonsrc = virStorageSourceNewFromBackingAbsolute(protocolwrapper))) {
         fprintf(stderr, "failed to parse disk json\n");
-        goto cleanup;
+        return -1;
     }
 
     if (virDomainDiskSourceFormat(&buf, jsonsrc, 0, 0, NULL) < 0 ||
         !(actualxml = virBufferContentAndReset(&buf))) {
         fprintf(stderr, "failed to format disk source xml\n");
-        goto cleanup;
+        return -1;
     }
 
     if (STRNEQ(actualxml, data->xml)) {
@@ -98,13 +97,10 @@ testBackingXMLjsonXML(const void *args)
                         "actual storage source xml:\n%s\n"
                         "intermediate json:\n%s\n",
                         data->xml, actualxml, protocolwrapper);
-        goto cleanup;
+        return -1;
     }
 
-    ret = 0;
-
- cleanup:
-    return ret;
+    return 0;
 }