[libvirt PATCH 5/7] virshtest: refactor testCompareOutputLit

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

 



Use g_autofree and get rid of the cleanup label.

Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 tests/virshtest.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/tests/virshtest.c b/tests/virshtest.c
index 189238b826..83675710ea 100644
--- a/tests/virshtest.c
+++ b/tests/virshtest.c
@@ -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", \
-- 
2.21.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