]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
secretxml2xmltest: refactor testCompareXMLToXMLFiles
authorJán Tomko <jtomko@redhat.com>
Sat, 4 Sep 2021 18:34:55 +0000 (20:34 +0200)
committerJán Tomko <jtomko@redhat.com>
Wed, 8 Sep 2021 13:29:05 +0000 (15:29 +0200)
Use g_auto where possible and remove the pointless label.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
tests/secretxml2xmltest.c

index 48f48416b58e5c4ec5f41b1f05bc99198194e24e..99aaa9db15a83608e72b5443cbed7bf7868c9376 100644 (file)
 static int
 testCompareXMLToXMLFiles(const char *inxml, const char *outxml)
 {
-    char *actual = NULL;
-    int ret = -1;
-    virSecretDef *secret = NULL;
+    g_autofree char *actual = NULL;
+    g_autoptr(virSecretDef) secret = NULL;
 
     if (!(secret = virSecretDefParseFile(inxml)))
-        goto fail;
+        return -1;
 
     if (!(actual = virSecretDefFormat(secret)))
-        goto fail;
+        return -1;
 
     if (virTestCompareToFile(actual, outxml) < 0)
-        goto fail;
+        return -1;
 
-    ret = 0;
-
- fail:
-    VIR_FREE(actual);
-    virSecretDefFree(secret);
-    return ret;
+    return 0;
 }
 
 struct testInfo {