render / rpms / libvirt

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