From nobody Mon Feb 9 10:51:45 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1642171245; cv=none; d=zohomail.com; s=zohoarc; b=MIf9j0I7nMecwZl3yMw8SYn1sRtutpYxYpXSp+CaPy0NzE6moa9wCslVerjELI8tYA+sWKAcFzuQSZ/2M4YKA5yckxhnZzqeyfaRQ0X7T2Pd1NCsBjFywOY91fPGbm4JDDJFus8I2pjVVJ7iRu9eApPstgPkMbo6SRcfacBRt9c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642171245; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=G0MQ0MJZWpl4aLaSVO7sAfEaT43i5Oy3hrfdtELlu3U=; b=mmAD1ltZgQoUwwpunRCK98InAKbDIlUh3sTC9xVamSiOaFSqQc00R8Nyes1PsRsJ3k/mSwiwVkYFarLb1MI3CtN3/6Xslt+/0hwKhYZh+PYIcCjEG9rfwZfnBfL9Ldg0KrLN50JWgeMnaT5QQH9LG4q44Ni0/vyUuo7IBfDC3cs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1642171245736306.4041163063382; Fri, 14 Jan 2022 06:40:45 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-175-ojgDfz0CNgGP797ecFWp2A-1; Fri, 14 Jan 2022 09:40:36 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 16C4184B9A9; Fri, 14 Jan 2022 14:40:29 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EA666106C07F; Fri, 14 Jan 2022 14:40:28 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id B618C4A70C; Fri, 14 Jan 2022 14:40:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20EEeI9K029326 for ; Fri, 14 Jan 2022 09:40:18 -0500 Received: by smtp.corp.redhat.com (Postfix) id 07EDB7B6F1; Fri, 14 Jan 2022 14:40:18 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7B1E07B6F4 for ; Fri, 14 Jan 2022 14:40:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642171244; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=G0MQ0MJZWpl4aLaSVO7sAfEaT43i5Oy3hrfdtELlu3U=; b=LatcAZRheMT0JX4sp0D7VJRvj7R64BJX9zjDe+XZiBomgvJqPYZpnEmCftiv5q7ifB0nr+ 0xpZM/H12kqTU/fDxy19bhguPMWyDe41I7IWLxefGW5b14Bay39mV3ysWE4q4zW4naVApN 2WduuU1UoJGTMXgTXCrn4OObhxFWMvg= X-MC-Unique: ojgDfz0CNgGP797ecFWp2A-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 11/11] virsh: Remove needless labels Date: Fri, 14 Jan 2022 15:39:55 +0100 Message-Id: <6a4084285d2b446e39f10ab139e1c92991a3d125.1642171139.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1642171246964100001 Content-Type: text/plain; charset="utf-8" There are few places where a cleanup label contains nothing but a return statement. Drop such labels and return directly. Signed-off-by: Michal Privoznik --- tools/virsh-host.c | 20 ++++++-------------- tools/vsh.c | 11 ++++------- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/tools/virsh-host.c b/tools/virsh-host.c index 5ee3834de2..2e3cbc39b6 100644 --- a/tools/virsh-host.c +++ b/tools/virsh-host.c @@ -1195,7 +1195,6 @@ static bool cmdCPUCompare(vshControl *ctl, const vshCmd *cmd) { const char *from =3D NULL; - bool ret =3D false; int result; g_auto(GStrv) cpus =3D NULL; unsigned int flags =3D 0; @@ -1219,7 +1218,7 @@ cmdCPUCompare(vshControl *ctl, const vshCmd *cmd) case VIR_CPU_COMPARE_INCOMPATIBLE: vshPrint(ctl, _("CPU described in %s is incompatible with host CPU= \n"), from); - goto cleanup; + return false; break; =20 case VIR_CPU_COMPARE_IDENTICAL: @@ -1235,13 +1234,10 @@ cmdCPUCompare(vshControl *ctl, const vshCmd *cmd) case VIR_CPU_COMPARE_ERROR: default: vshError(ctl, _("Failed to compare host CPU with %s"), from); - goto cleanup; + return false; } =20 - ret =3D true; - - cleanup: - return ret; + return true; } =20 /* @@ -1615,7 +1611,6 @@ cmdHypervisorCPUCompare(vshControl *ctl, const char *emulator =3D NULL; const char *arch =3D NULL; const char *machine =3D NULL; - bool ret =3D false; int result; g_auto(GStrv) cpus =3D NULL; unsigned int flags =3D 0; @@ -1646,7 +1641,7 @@ cmdHypervisorCPUCompare(vshControl *ctl, _("CPU described in %s is incompatible with the CPU provi= ded " "by hypervisor on the host\n"), from); - goto cleanup; + return false; break; =20 case VIR_CPU_COMPARE_IDENTICAL: @@ -1666,13 +1661,10 @@ cmdHypervisorCPUCompare(vshControl *ctl, case VIR_CPU_COMPARE_ERROR: default: vshError(ctl, _("Failed to compare hypervisor CPU with %s"), from); - goto cleanup; + return false; } =20 - ret =3D true; - - cleanup: - return ret; + return true; } =20 =20 diff --git a/tools/vsh.c b/tools/vsh.c index e3e27a0ba6..c0098054e0 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -3360,7 +3360,6 @@ const vshCmdInfo info_complete[] =3D { bool cmdComplete(vshControl *ctl, const vshCmd *cmd) { - bool ret =3D false; const vshClientHooks *hooks =3D ctl->hooks; int stdin_fileno =3D STDIN_FILENO; const char *arg =3D ""; @@ -3370,7 +3369,7 @@ cmdComplete(vshControl *ctl, const vshCmd *cmd) g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; =20 if (vshCommandOptStringQuiet(ctl, cmd, "string", &arg) <=3D 0) - goto cleanup; + return false; =20 /* This command is flagged VSH_CMD_FLAG_NOCONNECT because we * need to prevent auth hooks reading any input. Therefore, we @@ -3378,7 +3377,7 @@ cmdComplete(vshControl *ctl, const vshCmd *cmd) VIR_FORCE_CLOSE(stdin_fileno); =20 if (!(hooks && hooks->connHandler && hooks->connHandler(ctl))) - goto cleanup; + return false; =20 while ((opt =3D vshCommandOptArgv(ctl, cmd, opt))) { if (virBufferUse(&buf) !=3D 0) @@ -3397,7 +3396,7 @@ cmdComplete(vshControl *ctl, const vshCmd *cmd) rl_point =3D strlen(rl_line_buffer); =20 if (!(matches =3D vshReadlineCompletion(arg, 0, 0))) - goto cleanup; + return false; =20 for (iter =3D matches; *iter; iter++) { if (iter =3D=3D matches && matches[1]) @@ -3405,9 +3404,7 @@ cmdComplete(vshControl *ctl, const vshCmd *cmd) printf("%s\n", *iter); } =20 - ret =3D true; - cleanup: - return ret; + return true; } =20 =20 --=20 2.34.1