From nobody Mon Feb 9 05:01:02 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=1646229427; cv=none; d=zohomail.com; s=zohoarc; b=S5riIGiHZdRO7c1olBu9IxUmAqcU9bz3OaLWT9An6j3Fge5V2xdu+2ueUd7RM5O3X/QR8VUMWmmc+PBb7eyX9OoXl2FUK+B6V+ITGKQS/qLRMHtskFVbT2vPKWyTvy8Iu30ELKx1ynl1Ab2h7FUwmUkC9QobdJrJSWfi96Mlzgs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646229427; 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=cnMeOd9vzWockSceljymyjg5o9zs2n8FfhztgJbvp1Y=; b=V3N1azbCVGNyBQNnX2rqH3YJjAGunOjFroIj7PMS/Uz5fu7CBDJ15uT+qy5t21ISvELny+fDHV2W7LJjbWfmW+ShcaFvlukOPT4Cf3AVJzp3QZTxy4eyKD5ljh0Qe0VCN8uXZQ53ONC8AX/RjiuokP6Ds+QUTU8vuQv/l12sPIY= 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 1646229427129320.66085772962697; Wed, 2 Mar 2022 05:57:07 -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-25-dhFA01qdN42niVrvaIdAxQ-1; Wed, 02 Mar 2022 08:56:54 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A662218B9FB6; Wed, 2 Mar 2022 13:56:47 +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 8114E7D879; Wed, 2 Mar 2022 13:56:47 +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 5287C4ED28; Wed, 2 Mar 2022 13:56:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 222Duim1018282 for ; Wed, 2 Mar 2022 08:56:44 -0500 Received: by smtp.corp.redhat.com (Postfix) id 814BD83788; Wed, 2 Mar 2022 13:56:44 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id E35AB83783 for ; Wed, 2 Mar 2022 13:56:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646229426; 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=cnMeOd9vzWockSceljymyjg5o9zs2n8FfhztgJbvp1Y=; b=goDVKCcKXbTL6Qz//TG36UREDT/7YmMR+sF+ydVfkZ1n1yRxfcGf37Imc0LKIui/n/k0GX zHZsOtLv8iQY0O0vei/rgGzCpPw8HzR3N9EOxKTPQsIVmAnJHH6U6cYfwdsZDOGUDqkk8R +IkdtN3BkI7udg/DLsSm2+ocNThUqSY= X-MC-Unique: dhFA01qdN42niVrvaIdAxQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 22/23] virsh: domain: Don't use ternaries inside vshPrint/vshError functions Date: Wed, 2 Mar 2022 14:55:21 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.79 on 10.5.11.13 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: 1646229427651100005 Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa --- tools/virsh-domain.c | 50 ++++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 7b4f8638a9..89ad45dbf0 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -3929,11 +3929,13 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd) /* No way to emulate deletion of just snapshot metadata * without support for the newer flags. Oh well. */ if (has_snapshots_metadata) { - vshError(ctl, - snapshots_metadata ? - _("Unable to remove metadata of %d snapshots") : - _("Refusing to undefine while %d snapshots exist"), - has_snapshots_metadata); + if (snapshots_metadata) + vshError(ctl, _("Unable to remove metadata of %d snapshots"), + has_snapshots_metadata); + else + vshError(ctl, _("Refusing to undefine while %d snapshots exist= "), + has_snapshots_metadata); + goto cleanup; } @@ -8401,9 +8403,11 @@ cmdDesc(vshControl *ctl, const vshCmd *cmd) /* Compare original XML with edited. Has it changed at all? */ if (STREQ(desc, desc_edited)) { - vshPrintExtra(ctl, "%s", - title ? _("Domain title not changed\n") : - _("Domain description not changed\n"= )); + if (title) + vshPrintExtra(ctl, "%s", _("Domain title not changed\n= ")); + else + vshPrintExtra(ctl, "%s", _("Domain description not cha= nged\n")); + return true; } @@ -8412,26 +8416,32 @@ cmdDesc(vshControl *ctl, const vshCmd *cmd) } if (virDomainSetMetadata(dom, type, desc, NULL, NULL, flags) < 0) { - vshError(ctl, "%s", - title ? _("Failed to set new domain title") : - _("Failed to set new domain description")); + if (title) + vshError(ctl, "%s", _("Failed to set new domain title")); + else + vshError(ctl, "%s", _("Failed to set new domain descriptio= n")); + return false; } - vshPrintExtra(ctl, "%s", - title ? _("Domain title updated successfully") : - _("Domain description updated successfully")= ); + + if (title) + vshPrintExtra(ctl, "%s", _("Domain title updated successfully"= )); + else + vshPrintExtra(ctl, "%s", _("Domain description updated success= fully")); + } else { desc =3D virshGetDomainDescription(ctl, dom, title, queryflags); if (!desc) return false; - if (strlen(desc) > 0) + if (strlen(desc) > 0) { vshPrint(ctl, "%s", desc); - else - vshPrintExtra(ctl, - title ? _("No title for domain: %s") : - _("No description for domain: %s"), - virDomainGetName(dom)); + } else { + if (title) + vshPrintExtra(ctl, _("No title for domain: %s"), virDomain= GetName(dom)); + else + vshPrintExtra(ctl, _("No description for domain: %s"), vir= DomainGetName(dom)); + } } return true; --=20 2.35.1