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