1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-10 05:17:59 +03:00

testVshTableHeader: Cleanup

Remove unnecessary label and goto. This also fixes a bug where a
failure to create the table would result in the test passing.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Tim Wiederhake 2021-11-08 12:49:16 +01:00
parent 1fc3f05293
commit f976f90465

View File

@ -45,7 +45,8 @@ static int
testVshTableHeader(const void *opaque G_GNUC_UNUSED)
{
int ret = 0;
char *act = NULL;
g_autofree char *act = NULL;
g_autofree char *act2 = NULL;
const char *exp =
" 1 fedora28 running\n"
" 2 rhel7.5 running\n";
@ -58,7 +59,7 @@ testVshTableHeader(const void *opaque G_GNUC_UNUSED)
g_autoptr(vshTable) table = vshTableNew("Id", "Name", "State",
NULL); //to ask about return
if (!table)
goto cleanup;
return -1;
vshTableRowAppend(table, "1", "fedora28", "running", NULL);
vshTableRowAppend(table, "2", "rhel7.5", "running",
@ -68,13 +69,10 @@ testVshTableHeader(const void *opaque G_GNUC_UNUSED)
if (virTestCompareToString(exp, act) < 0)
ret = -1;
VIR_FREE(act);
act = vshTablePrintToString(table, true);
if (virTestCompareToString(exp2, act) < 0)
act2 = vshTablePrintToString(table, true);
if (virTestCompareToString(exp2, act2) < 0)
ret = -1;
cleanup:
VIR_FREE(act);
return ret;
}