mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 11:35:19 +00:00
virshtest: refactor testCompareOutputLit
Use g_autofree and get rid of the cleanup label. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
994688e0df
commit
8bacdde9d5
@ -60,26 +60,20 @@ static int
|
||||
testCompareOutputLit(const char *expectData,
|
||||
const char *filter, const char *const argv[])
|
||||
{
|
||||
int result = -1;
|
||||
char *actualData = NULL;
|
||||
g_autofree char *actualData = NULL;
|
||||
|
||||
if (virTestCaptureProgramOutput(argv, &actualData, 4096) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (filter && testFilterLine(actualData, filter) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (STRNEQ(expectData, actualData)) {
|
||||
virTestDifference(stderr, expectData, actualData);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
result = 0;
|
||||
|
||||
cleanup:
|
||||
VIR_FREE(actualData);
|
||||
|
||||
return result;
|
||||
return 0;
|
||||
}
|
||||
|
||||
# define VIRSH_DEFAULT abs_top_builddir "/tools/virsh", \
|
||||
|
Loading…
Reference in New Issue
Block a user