From nobody Tue Nov 26 15:29:16 2024 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=1571282583; cv=none; d=zoho.com; s=zohoarc; b=HHflzdtOWk7lWyK7R6rb7vjEsO68G7+v4CnVUsT+SZtkjnNAFvmfHbnpXHKMliXzQkprBUgicBwDp299oDs1wJAahLWDobbdGYamep/hijpHZ07VgvkxiNxnOqC2Koyqf8QIFFVar2m9+1DzUmtTlWBsozikJ1Smm/u7gyfm6n0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571282583; 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=ioY3uFhTI9ORo954770ZvPlGKRmp9GFOD7PCRQpp+W8=; b=Q6KRaiKVDTRPwEzcSZcaEelOWcXITGKjqy9wPt7qbS0XTdTnDhprExU6IPmDZwUJrM4uZqeq59agoMD4YNwWFLvngoYk+pdmXAJH7//itgOZ8iOQa2sU4ZcsrPAkYrRy1Q/y+cGuQIXFrp6PRhU9G+9EaYHKglS7qM5nqcJBlmA= 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 1571282582685924.3050056077318; Wed, 16 Oct 2019 20:23:02 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C45CE59449; Thu, 17 Oct 2019 03:22:59 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3522F5C1D4; Thu, 17 Oct 2019 03:22:57 +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 E8A8D180B536; Thu, 17 Oct 2019 03:22:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9H3KUpd002765 for ; Wed, 16 Oct 2019 23:20:30 -0400 Received: by smtp.corp.redhat.com (Postfix) id 259836FDA0; Thu, 17 Oct 2019 03:20:30 +0000 (UTC) Received: from mx1.redhat.com (ext-mx24.extmail.prod.ext.phx2.redhat.com [10.5.110.65]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 20AEC60872 for ; Thu, 17 Oct 2019 03:20:30 +0000 (UTC) Received: from cmccmta3.chinamobile.com (cmccmta3.chinamobile.com [221.176.66.81]) by mx1.redhat.com (Postfix) with ESMTP id 81AC310CC211 for ; Thu, 17 Oct 2019 03:20:12 +0000 (UTC) Received: from spf.mail.chinamobile.com (unknown[172.16.121.5]) by rmmx-syy-dmz-app10-12010 (RichMail) with SMTP id 2eea5da7ddcf660-b08a3; Thu, 17 Oct 2019 11:19:43 +0800 (CST) Received: from localhost.localdomain (unknown[112.25.154.149]) by rmsmtp-syy-appsvr03-12003 (RichMail) with SMTP id 2ee35da7ddc6aab-7fa39; Thu, 17 Oct 2019 11:19:43 +0800 (CST) X-RM-TRANSID: 2eea5da7ddcf660-b08a3 X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 X-RM-TRANSID: 2ee35da7ddc6aab-7fa39 From: Mao Zhongyi To: libvir-list@redhat.com Date: Thu, 17 Oct 2019 11:19:33 +0800 Message-Id: <0d15272150b59a81d9a865ee5c5abd541e5bb57a.1571281133.git.maozhongyi@cmss.chinamobile.com> In-Reply-To: References: In-Reply-To: References: X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 238 matched, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.65]); Thu, 17 Oct 2019 03:20:23 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.65]); Thu, 17 Oct 2019 03:20:23 +0000 (UTC) for IP:'221.176.66.81' DOMAIN:'cmccmta3.chinamobile.com' HELO:'cmccmta3.chinamobile.com' FROM:'maozhongyi@cmss.chinamobile.com' RCPT:'' X-RedHat-Spam-Score: -0.699 (RCVD_IN_DNSWL_LOW, SPF_NONE) 221.176.66.81 cmccmta3.chinamobile.com 221.176.66.81 cmccmta3.chinamobile.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.65 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Zhang Shengju , Mao Zhongyi Subject: [libvirt] [PATCH v2 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.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 17 Oct 2019 03:23:00 +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. Signed-off-by: Mao Zhongyi Signed-off-by: Zhang Shengju --- src/qemu/qemu_migration_params.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_par= ams.c index 85fa8f8de5..f5bc8596f4 100644 --- a/src/qemu/qemu_migration_params.c +++ b/src/qemu/qemu_migration_params.c @@ -1326,12 +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 - rc =3D -1; + rc =3D virStringParseYesNo(value, &pv->value.b); break; =20 case QEMU_MIGRATION_PARAM_TYPE_STRING: --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list