render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
fbe740
From 868b112fabc71f2247d2e4880f207f31727b549c Mon Sep 17 00:00:00 2001
fbe740
Message-Id: <868b112fabc71f2247d2e4880f207f31727b549c@dist-git>
fbe740
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
fbe740
Date: Fri, 13 Mar 2020 13:08:04 +0100
fbe740
Subject: [PATCH] virbuftest: remove unnecessary labels
fbe740
MIME-Version: 1.0
fbe740
Content-Type: text/plain; charset=UTF-8
fbe740
Content-Transfer-Encoding: 8bit
fbe740
fbe740
Remove the ret variables and labels from functions that no longer need
fbe740
them.
fbe740
fbe740
Signed-off-by: Ján Tomko <jtomko@redhat.com>
fbe740
Reviewed-by: Erik Skultety <eskultet@redhat.com>
fbe740
(cherry picked from commit 662876723cdfb138ca31847fdb3a84bbe3cadea5)
fbe740
fbe740
Prerequisite for: https://bugzilla.redhat.com/show_bug.cgi?id=1808499
fbe740
fbe740
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
fbe740
Message-Id: <8d02662ab00fa2c7088912148fb1131f24623d32.1584101247.git.mprivozn@redhat.com>
fbe740
Reviewed-by: Ján Tomko <jtomko@redhat.com>
fbe740
---
fbe740
 tests/virbuftest.c | 40 ++++++++++++----------------------------
fbe740
 1 file changed, 12 insertions(+), 28 deletions(-)
fbe740
fbe740
diff --git a/tests/virbuftest.c b/tests/virbuftest.c
fbe740
index 2b241424ad..bb7fa9e2e9 100644
fbe740
--- a/tests/virbuftest.c
fbe740
+++ b/tests/virbuftest.c
fbe740
@@ -246,7 +246,6 @@ testBufAddStr(const void *opaque)
fbe740
     const struct testBufAddStrData *data = opaque;
fbe740
     virBuffer buf = VIR_BUFFER_INITIALIZER;
fbe740
     g_autofree char *actual = NULL;
fbe740
-    int ret = -1;
fbe740
 
fbe740
     virBufferAddLit(&buf, "<c>\n");
fbe740
     virBufferAdjustIndent(&buf, 2);
fbe740
@@ -256,19 +255,16 @@ testBufAddStr(const void *opaque)
fbe740
 
fbe740
     if (!(actual = virBufferContentAndReset(&buf))) {
fbe740
         VIR_TEST_DEBUG("buf is empty");
fbe740
-        goto cleanup;
fbe740
+        return -1;
fbe740
     }
fbe740
 
fbe740
     if (STRNEQ_NULLABLE(actual, data->expect)) {
fbe740
         VIR_TEST_DEBUG("testBufAddStr(): Strings don't match:");
fbe740
         virTestDifference(stderr, data->expect, actual);
fbe740
-        goto cleanup;
fbe740
+        return -1;
fbe740
     }
fbe740
 
fbe740
-    ret = 0;
fbe740
-
fbe740
- cleanup:
fbe740
-    return ret;
fbe740
+    return 0;
fbe740
 }
fbe740
 
fbe740
 
fbe740
@@ -278,7 +274,6 @@ testBufEscapeStr(const void *opaque)
fbe740
     const struct testBufAddStrData *data = opaque;
fbe740
     virBuffer buf = VIR_BUFFER_INITIALIZER;
fbe740
     g_autofree char *actual = NULL;
fbe740
-    int ret = -1;
fbe740
 
fbe740
     virBufferAddLit(&buf, "<c>\n");
fbe740
     virBufferAdjustIndent(&buf, 2);
fbe740
@@ -288,19 +283,16 @@ testBufEscapeStr(const void *opaque)
fbe740
 
fbe740
     if (!(actual = virBufferContentAndReset(&buf))) {
fbe740
         VIR_TEST_DEBUG("buf is empty");
fbe740
-        goto cleanup;
fbe740
+        return -1;
fbe740
     }
fbe740
 
fbe740
     if (STRNEQ_NULLABLE(actual, data->expect)) {
fbe740
         VIR_TEST_DEBUG("testBufEscapeStr(): Strings don't match:");
fbe740
         virTestDifference(stderr, data->expect, actual);
fbe740
-        goto cleanup;
fbe740
+        return -1;
fbe740
     }
fbe740
 
fbe740
-    ret = 0;
fbe740
-
fbe740
- cleanup:
fbe740
-    return ret;
fbe740
+    return 0;
fbe740
 }
fbe740
 
fbe740
 
fbe740
@@ -310,25 +302,21 @@ testBufEscapeRegex(const void *opaque)
fbe740
     const struct testBufAddStrData *data = opaque;
fbe740
     virBuffer buf = VIR_BUFFER_INITIALIZER;
fbe740
     g_autofree char *actual = NULL;
fbe740
-    int ret = -1;
fbe740
 
fbe740
     virBufferEscapeRegex(&buf, "%s", data->data);
fbe740
 
fbe740
     if (!(actual = virBufferContentAndReset(&buf))) {
fbe740
         VIR_TEST_DEBUG("testBufEscapeRegex: buf is empty");
fbe740
-        goto cleanup;
fbe740
+        return -1;
fbe740
     }
fbe740
 
fbe740
     if (STRNEQ_NULLABLE(actual, data->expect)) {
fbe740
         VIR_TEST_DEBUG("testBufEscapeRegex: Strings don't match:");
fbe740
         virTestDifference(stderr, data->expect, actual);
fbe740
-        goto cleanup;
fbe740
+        return -1;
fbe740
     }
fbe740
 
fbe740
-    ret = 0;
fbe740
-
fbe740
- cleanup:
fbe740
-    return ret;
fbe740
+    return 0;
fbe740
 }
fbe740
 
fbe740
 
fbe740
@@ -337,7 +325,6 @@ testBufSetIndent(const void *opaque G_GNUC_UNUSED)
fbe740
 {
fbe740
     virBuffer buf = VIR_BUFFER_INITIALIZER;
fbe740
     g_autofree char *actual = NULL;
fbe740
-    int ret = -1;
fbe740
 
fbe740
     virBufferSetIndent(&buf, 11);
fbe740
     virBufferAddLit(&buf, "test\n");
fbe740
@@ -345,17 +332,14 @@ testBufSetIndent(const void *opaque G_GNUC_UNUSED)
fbe740
     virBufferAddLit(&buf, "test2\n");
fbe740
 
fbe740
     if (!(actual = virBufferContentAndReset(&buf)))
fbe740
-        goto cleanup;
fbe740
+        return -1;
fbe740
 
fbe740
     if (STRNEQ(actual, "           test\n  test2\n")) {
fbe740
         VIR_TEST_DEBUG("testBufSetIndent: expected indent not set");
fbe740
-        goto cleanup;
fbe740
+        return -1;
fbe740
     }
fbe740
 
fbe740
-    ret = 0;
fbe740
-
fbe740
- cleanup:
fbe740
-    return ret;
fbe740
+    return 0;
fbe740
 }
fbe740
 
fbe740
 
fbe740
-- 
fbe740
2.25.1
fbe740