mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
tests: remove superfluous cleanup: labels and ret return variables
After converting virNetworkDef * to g_autoptr(virNetworkDef) the cleanup codepath was empty, so it has been removed. Signed-off-by: Laine Stump <laine@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
@@ -90,17 +90,16 @@ static int testCompareXMLToArgvFiles(const char *xml,
|
|||||||
g_autofree char *actualargv = NULL;
|
g_autofree char *actualargv = NULL;
|
||||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
g_autoptr(virNetworkDef) def = NULL;
|
g_autoptr(virNetworkDef) def = NULL;
|
||||||
int ret = -1;
|
|
||||||
char *actual;
|
char *actual;
|
||||||
g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
|
g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
|
||||||
|
|
||||||
virCommandSetDryRun(dryRunToken, &buf, true, true, testCommandDryRun, NULL);
|
virCommandSetDryRun(dryRunToken, &buf, true, true, testCommandDryRun, NULL);
|
||||||
|
|
||||||
if (!(def = virNetworkDefParseFile(xml, NULL)))
|
if (!(def = virNetworkDefParseFile(xml, NULL)))
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (networkAddFirewallRules(def) < 0)
|
if (networkAddFirewallRules(def) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
actual = actualargv = virBufferContentAndReset(&buf);
|
actual = actualargv = virBufferContentAndReset(&buf);
|
||||||
|
|
||||||
@@ -112,12 +111,9 @@ static int testCompareXMLToArgvFiles(const char *xml,
|
|||||||
actual += strlen(baseargs);
|
actual += strlen(baseargs);
|
||||||
|
|
||||||
if (virTestCompareToFileFull(actual, cmdline, false) < 0)
|
if (virTestCompareToFileFull(actual, cmdline, false) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
|
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct testInfo {
|
struct testInfo {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ testCompareXMLToXMLFiles(const char *netxml, const char *updatexml,
|
|||||||
g_autoptr(virNetworkDef) def = NULL;
|
g_autoptr(virNetworkDef) def = NULL;
|
||||||
|
|
||||||
if (virTestLoadFile(updatexml, &updateXmlData) < 0)
|
if (virTestLoadFile(updatexml, &updateXmlData) < 0)
|
||||||
goto error;
|
return -1;
|
||||||
|
|
||||||
if (!(def = virNetworkDefParseFile(netxml, NULL)))
|
if (!(def = virNetworkDefParseFile(netxml, NULL)))
|
||||||
goto fail;
|
goto fail;
|
||||||
@@ -37,7 +37,7 @@ testCompareXMLToXMLFiles(const char *netxml, const char *updatexml,
|
|||||||
|
|
||||||
if (!expectFailure) {
|
if (!expectFailure) {
|
||||||
if (virTestCompareToFile(actual, outxml) < 0)
|
if (virTestCompareToFile(actual, outxml) < 0)
|
||||||
goto error;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
@@ -52,7 +52,6 @@ testCompareXMLToXMLFiles(const char *netxml, const char *updatexml,
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
error:
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user