[libvirt PATCH 21/24] tests: nwfilter: remove pointless labels

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

 



Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 tests/nwfilterebiptablestest.c | 63 ++++++++++++----------------------
 1 file changed, 21 insertions(+), 42 deletions(-)

diff --git a/tests/nwfilterebiptablestest.c b/tests/nwfilterebiptablestest.c
index 7b32e90d19..9307a10229 100644
--- a/tests/nwfilterebiptablestest.c
+++ b/tests/nwfilterebiptablestest.c
@@ -102,24 +102,21 @@ testNWFilterEBIPTablesAllTeardown(const void *opaque G_GNUC_UNUSED)
         "ebtables --concurrent -t nat -F libvirt-O-vnet0\n"
         "ebtables --concurrent -t nat -X libvirt-O-vnet0\n";
     g_autofree char *actual = NULL;
-    int ret = -1;
     g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
 
     virCommandSetDryRun(dryRunToken, &buf, false, true, NULL, NULL);
 
     if (ebiptables_driver.allTeardown("vnet0") < 0)
-        goto cleanup;
+        return -1;
 
     actual = virBufferContentAndReset(&buf);
 
     if (STRNEQ_NULLABLE(actual, expected)) {
         virTestDifference(stderr, expected, actual);
-        goto cleanup;
+        return -1;
     }
 
-    ret = 0;
- cleanup:
-    return ret;
+    return 0;
 }
 
 
@@ -167,24 +164,21 @@ testNWFilterEBIPTablesTearOldRules(const void *opaque G_GNUC_UNUSED)
         "ebtables --concurrent -t nat -E libvirt-J-vnet0 libvirt-I-vnet0\n"
         "ebtables --concurrent -t nat -E libvirt-P-vnet0 libvirt-O-vnet0\n";
     g_autofree char *actual = NULL;
-    int ret = -1;
     g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
 
     virCommandSetDryRun(dryRunToken, &buf, false, true, NULL, NULL);
 
     if (ebiptables_driver.tearOldRules("vnet0") < 0)
-        goto cleanup;
+        return -1;
 
     actual = virBufferContentAndReset(&buf);
 
     if (STRNEQ_NULLABLE(actual, expected)) {
         virTestDifference(stderr, expected, actual);
-        goto cleanup;
+        return -1;
     }
 
-    ret = 0;
- cleanup:
-    return ret;
+    return 0;
 }
 
 
@@ -210,24 +204,21 @@ testNWFilterEBIPTablesRemoveBasicRules(const void *opaque G_GNUC_UNUSED)
         "ebtables --concurrent -t nat -F libvirt-P-vnet0\n"
         "ebtables --concurrent -t nat -X libvirt-P-vnet0\n";
     g_autofree char *actual = NULL;
-    int ret = -1;
     g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
 
     virCommandSetDryRun(dryRunToken, &buf, false, true, NULL, NULL);
 
     if (ebiptables_driver.removeBasicRules("vnet0") < 0)
-        goto cleanup;
+        return -1;
 
     actual = virBufferContentAndReset(&buf);
 
     if (STRNEQ_NULLABLE(actual, expected)) {
         virTestDifference(stderr, expected, actual);
-        goto cleanup;
+        return -1;
     }
 
-    ret = 0;
- cleanup:
-    return ret;
+    return 0;
 }
 
 
@@ -238,24 +229,21 @@ testNWFilterEBIPTablesTearNewRules(const void *opaque G_GNUC_UNUSED)
     const char *expected =
         VIR_NWFILTER_NEW_RULES_TEARDOWN;
     g_autofree char *actual = NULL;
-    int ret = -1;
     g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
 
     virCommandSetDryRun(dryRunToken, &buf, false, true, NULL, NULL);
 
     if (ebiptables_driver.tearNewRules("vnet0") < 0)
-        goto cleanup;
+        return -1;
 
     actual = virBufferContentAndReset(&buf);
 
     if (STRNEQ_NULLABLE(actual, expected)) {
         virTestDifference(stderr, expected, actual);
-        goto cleanup;
+        return -1;
     }
 
-    ret = 0;
- cleanup:
-    return ret;
+    return 0;
 }
 
 
@@ -303,25 +291,22 @@ testNWFilterEBIPTablesApplyBasicRules(const void *opaque G_GNUC_UNUSED)
         "ebtables --concurrent -t nat -A PREROUTING -i vnet0 -j libvirt-J-vnet0\n"
         "ebtables --concurrent -t nat -E libvirt-J-vnet0 libvirt-I-vnet0\n";
     g_autofree char *actual = NULL;
-    int ret = -1;
     virMacAddr mac = { .addr = { 0x10, 0x20, 0x30, 0x40, 0x50, 0x60 } };
     g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
 
     virCommandSetDryRun(dryRunToken, &buf, false, true, NULL, NULL);
 
     if (ebiptables_driver.applyBasicRules("vnet0", &mac) < 0)
-        goto cleanup;
+        return -1;
 
     actual = virBufferContentAndReset(&buf);
 
     if (STRNEQ_NULLABLE(actual, expected)) {
         virTestDifference(stderr, expected, actual);
-        goto cleanup;
+        return -1;
     }
 
-    ret = 0;
- cleanup:
-    return ret;
+    return 0;
 }
 
 
@@ -377,7 +362,6 @@ testNWFilterEBIPTablesApplyDHCPOnlyRules(const void *opaque G_GNUC_UNUSED)
         "ebtables --concurrent -t nat -E libvirt-J-vnet0 libvirt-I-vnet0\n"
         "ebtables --concurrent -t nat -E libvirt-P-vnet0 libvirt-O-vnet0\n";
     g_autofree char *actual = NULL;
-    int ret = -1;
     virMacAddr mac = { .addr = { 0x10, 0x20, 0x30, 0x40, 0x50, 0x60 } };
     const char *servers[] = { "192.168.122.1", "10.0.0.1", "10.0.0.2" };
     virNWFilterVarValue val = {
@@ -394,18 +378,16 @@ testNWFilterEBIPTablesApplyDHCPOnlyRules(const void *opaque G_GNUC_UNUSED)
     virCommandSetDryRun(dryRunToken, &buf, false, true, NULL, NULL);
 
     if (ebiptables_driver.applyDHCPOnlyRules("vnet0", &mac, &val, false) < 0)
-        goto cleanup;
+        return -1;
 
     actual = virBufferContentAndReset(&buf);
 
     if (STRNEQ_NULLABLE(actual, expected)) {
         virTestDifference(stderr, expected, actual);
-        goto cleanup;
+        return -1;
     }
 
-    ret = 0;
- cleanup:
-    return ret;
+    return 0;
 }
 
 
@@ -455,24 +437,21 @@ testNWFilterEBIPTablesApplyDropAllRules(const void *opaque G_GNUC_UNUSED)
         "ebtables --concurrent -t nat -E libvirt-J-vnet0 libvirt-I-vnet0\n"
         "ebtables --concurrent -t nat -E libvirt-P-vnet0 libvirt-O-vnet0\n";
     g_autofree char *actual = NULL;
-    int ret = -1;
     g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
 
     virCommandSetDryRun(dryRunToken, &buf, false, true, NULL, NULL);
 
     if (ebiptables_driver.applyDropAllRules("vnet0") < 0)
-        goto cleanup;
+        return -1;
 
     actual = virBufferContentAndReset(&buf);
 
     if (STRNEQ_NULLABLE(actual, expected)) {
         virTestDifference(stderr, expected, actual);
-        goto cleanup;
+        return -1;
     }
 
-    ret = 0;
- cleanup:
-    return ret;
+    return 0;
 }
 
 
-- 
2.31.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