[libvirt PATCH 6/6] Remove redundant labels

Martin Kletzander mkletzan at redhat.com
Tue Aug 17 13:57:43 UTC 2021


On Tue, Aug 17, 2021 at 02:25:33PM +0200, Ján Tomko wrote:
>Signed-off-by: Ján Tomko <jtomko at redhat.com>
>---
> src/conf/cpu_conf.c              | 12 ++++--------
> src/conf/virnetworkportdef.c     | 10 +++-------
> src/conf/virnwfilterbindingdef.c | 10 +++-------
> src/conf/virnwfilterbindingobj.c | 10 +++-------
> src/conf/virsavecookie.c         | 14 ++++----------
> src/conf/virstorageobj.c         | 12 +++++-------
> src/libxl/libxl_migration.c      |  8 ++------
> src/qemu/qemu_migration_cookie.c |  9 ++-------
> src/security/virt-aa-helper.c    | 17 ++++++-----------
> src/storage/storage_util.c       | 17 ++++++-----------
> src/vz/vz_driver.c               |  4 +---
> tests/cputest.c                  | 14 ++++++--------
> tests/metadatatest.c             | 13 ++++---------
> 13 files changed, 49 insertions(+), 101 deletions(-)
>
>diff --git a/src/libxl/libxl_migration.c b/src/libxl/libxl_migration.c
>index a2c2b6dbde..aa719a19d2 100644
>--- a/src/libxl/libxl_migration.c
>+++ b/src/libxl/libxl_migration.c
>@@ -151,7 +151,6 @@ libxlMigrationEatCookie(const char *cookiein,
>     g_autoptr(xmlDoc) doc = NULL;
>     g_autoptr(xmlXPathContext) ctxt = NULL;
>     g_autofree char *uuidstr = NULL;
>-    int ret = -1;
>
>     /*
>      * Assume a legacy (V1) migration stream if request came from a
>@@ -209,14 +208,11 @@ libxlMigrationEatCookie(const char *cookiein,
>     }
>
>     *migout = mig;
>-    ret = 0;
>-    goto cleanup;
>+    return 0;
>
>  error:
>     libxlMigrationCookieFree(mig);

Extra pointer could get rid of this label without adding more lines, but
unfortunately without removing any either :( I know it's not related to
this patch, I just don't like this label here for some reason.

>-
>- cleanup:
>-    return ret;
>+    return -1;
> }
>
> static void
>diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_cookie.c
>index 106897cacd..b67728f9c0 100644
>--- a/src/qemu/qemu_migration_cookie.c
>+++ b/src/qemu/qemu_migration_cookie.c
>@@ -1433,18 +1433,13 @@ qemuMigrationCookieXMLParseStr(qemuMigrationCookie *mig,
> {
>     g_autoptr(xmlDoc) doc = NULL;
>     g_autoptr(xmlXPathContext) ctxt = NULL;
>-    int ret = -1;
>
>     VIR_DEBUG("xml=%s", NULLSTR(xml));
>
>     if (!(doc = virXMLParseStringCtxt(xml, _("(qemu_migration_cookie)"), &ctxt)))

Another unrelated rant -- life would be much easier if we wouldn't need
to free the return value.  Unfortunately it is needed in roughly 4
places :(

Anyway, the whole series is

Reviewed-by: Martin Kletzander <mkletzan at redhat.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20210817/1aa2443c/attachment-0001.sig>


More information about the libvir-list mailing list