render / rpms / libvirt

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