From nobody Tue Feb 10 20:07:00 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1571194240; cv=none; d=zoho.com; s=zohoarc; b=XMykwHpHcJ+rAlUyMEt6UmQCK10j/MhCN2VMhW9HTl0o8H9fOh9cWZQVG+/iqGN1GR4rih18fNEJTo+Wbt0WXNw+AYaPbwL6ZZ6jeisruSyJ2rHmVQeikyGq4rF3VE0acvaGEAsXLJBTK0UvIIsnojpYEjW8ivi9sN5RcA62inc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571194240; h=Content-Type:Content-Transfer-Encoding:Cc: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=uIcqsJ+hU3NcvF+vnyEpOHPBID0O3bEpRJQb974oyxA=; b=C/G1U1s2SewotzyRD7VogWmOvKQ8Ns/SH4opuWW2qmp5BDC5qAfvdjumU8Lr0/9LhkrtGfJZqSMf8Tp5UgJYkejDoGir6NLAJMnJqQ5Eb925tkfYlYqub2Rb9Q9quosJwKZYyRKzJ66TkLoNPZNQUBA93IXGpa81eN/VfVBkuE4= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1571194239826799.2963334049193; Tue, 15 Oct 2019 19:50:39 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 13E5261D25; Wed, 16 Oct 2019 02:50:37 +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 DE02010027A9; Wed, 16 Oct 2019 02:50:36 +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 924054EA65; Wed, 16 Oct 2019 02:50:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9G2f1J0025487 for ; Tue, 15 Oct 2019 22:41:03 -0400 Received: by smtp.corp.redhat.com (Postfix) id 115965DC1E; Wed, 16 Oct 2019 02:41:01 +0000 (UTC) Received: from mx1.redhat.com (ext-mx12.extmail.prod.ext.phx2.redhat.com [10.5.110.41]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 902CF5DA8C; Wed, 16 Oct 2019 02:40:59 +0000 (UTC) Received: from cmccmta1.chinamobile.com (cmccmta1.chinamobile.com [221.176.66.79]) by mx1.redhat.com (Postfix) with ESMTP id 742E73172D88; Wed, 16 Oct 2019 02:40:48 +0000 (UTC) Received: from spf.mail.chinamobile.com (unknown[172.16.121.11]) by rmmx-syy-dmz-app04-12004 (RichMail) with SMTP id 2ee45da6831737e-98579; Wed, 16 Oct 2019 10:40:23 +0800 (CST) Received: from localhost.localdomain (unknown[112.25.154.149]) by rmsmtp-syy-appsvr06-12006 (RichMail) with SMTP id 2ee65da68308dda-b7955; Wed, 16 Oct 2019 10:40:23 +0800 (CST) X-RM-TRANSID: 2ee45da6831737e-98579 X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 X-RM-TRANSID: 2ee65da68308dda-b7955 From: Mao Zhongyi To: libvir-list@redhat.com Date: Wed, 16 Oct 2019 10:39:50 +0800 Message-Id: <20191016023950.1623751-4-maozhongyi@cmss.chinamobile.com> In-Reply-To: <20191016023950.1623751-1-maozhongyi@cmss.chinamobile.com> References: <20191016023950.1623751-1-maozhongyi@cmss.chinamobile.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 238 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Wed, 16 Oct 2019 02:40:49 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Wed, 16 Oct 2019 02:40:49 +0000 (UTC) for IP:'221.176.66.79' DOMAIN:'cmccmta1.chinamobile.com' HELO:'cmccmta1.chinamobile.com' FROM:'maozhongyi@cmss.chinamobile.com' RCPT:'' X-RedHat-Spam-Score: -0.698 (RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE) 221.176.66.79 cmccmta1.chinamobile.com 221.176.66.79 cmccmta1.chinamobile.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.41 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: jdenemar@redhat.com, g.sho1500@gmail.com, zhangshengju@cmss.chinamobile.com, maozhongyi@cmss.chinamobile.com Subject: [libvirt] [PATCH 3/3] qemu/qemu_migration_params: use virStringParseYesNo helper 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 16 Oct 2019 02:50:37 +0000 (UTC) Content-Type: text/plain; charset="utf-8" A function virStringParseYesNo was added to convert string 'yes' to true and 'no' to false, so use this helper to replace 'STREQ(.*, \"yes\")' and 'STREQ(.*, \"no\")' as it allows us to drop several repetitive if-then-else string->bool conversion blocks. Cc: jdenemar@redhat.com Cc: g.sho1500@gmail.com Cc: crobinso@redhat.com Signed-off-by: Mao Zhongyi Signed-off-by: Zhang Shengju --- src/qemu/qemu_migration_params.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_par= ams.c index 85fa8f8de5..acd42042fe 100644 --- a/src/qemu/qemu_migration_params.c +++ b/src/qemu/qemu_migration_params.c @@ -1326,11 +1326,7 @@ qemuMigrationParamsParse(xmlXPathContextPtr ctxt, break; =20 case QEMU_MIGRATION_PARAM_TYPE_BOOL: - if (STREQ(value, "yes")) - pv->value.b =3D true; - else if (STREQ(value, "no")) - pv->value.b =3D false; - else + if (virStringParseYesNo(value, &pv->value.b) < 0) rc =3D -1; break; =20 --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list