[libvirt PATCH 10/16] tests: remove superfluous cleanup: labels and ret return variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



After converting virNetworkDef * to g_autoptr(virNetworkDef) the
cleanup codepath was empty, so it has been removed.

Signed-off-by: Laine Stump <laine@xxxxxxxxxx>
---
 tests/networkxml2firewalltest.c  | 12 ++++--------
 tests/networkxml2xmlupdatetest.c |  5 ++---
 2 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/tests/networkxml2firewalltest.c b/tests/networkxml2firewalltest.c
index f895ca8c56..ca793fd4ea 100644
--- a/tests/networkxml2firewalltest.c
+++ b/tests/networkxml2firewalltest.c
@@ -90,17 +90,16 @@ static int testCompareXMLToArgvFiles(const char *xml,
     g_autofree char *actualargv = NULL;
     g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
     g_autoptr(virNetworkDef) def = NULL;
-    int ret = -1;
     char *actual;
     g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
 
     virCommandSetDryRun(dryRunToken, &buf, true, true, testCommandDryRun, NULL);
 
     if (!(def = virNetworkDefParseFile(xml, NULL)))
-        goto cleanup;
+        return -1;
 
     if (networkAddFirewallRules(def) < 0)
-        goto cleanup;
+        return -1;
 
     actual = actualargv = virBufferContentAndReset(&buf);
 
@@ -112,12 +111,9 @@ static int testCompareXMLToArgvFiles(const char *xml,
         actual += strlen(baseargs);
 
     if (virTestCompareToFileFull(actual, cmdline, false) < 0)
-        goto cleanup;
+        return -1;
 
-    ret = 0;
-
- cleanup:
-    return ret;
+    return 0;
 }
 
 struct testInfo {
diff --git a/tests/networkxml2xmlupdatetest.c b/tests/networkxml2xmlupdatetest.c
index 4926609f90..58b6f70c96 100644
--- a/tests/networkxml2xmlupdatetest.c
+++ b/tests/networkxml2xmlupdatetest.c
@@ -23,7 +23,7 @@ testCompareXMLToXMLFiles(const char *netxml, const char *updatexml,
     g_autoptr(virNetworkDef) def = NULL;
 
     if (virTestLoadFile(updatexml, &updateXmlData) < 0)
-        goto error;
+        return -1;
 
     if (!(def = virNetworkDefParseFile(netxml, NULL)))
         goto fail;
@@ -37,7 +37,7 @@ testCompareXMLToXMLFiles(const char *netxml, const char *updatexml,
 
     if (!expectFailure) {
         if (virTestCompareToFile(actual, outxml) < 0)
-            goto error;
+            return -1;
     }
 
     ret = 0;
@@ -52,7 +52,6 @@ testCompareXMLToXMLFiles(const char *netxml, const char *updatexml,
             ret = 0;
         }
     }
- error:
     return ret;
 }
 
-- 
2.37.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux