From nobody Thu May 15 20:54:22 2025 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1504025308121546.9678512068313; Tue, 29 Aug 2017 09:48:28 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DC9724E909; Tue, 29 Aug 2017 16:48:25 +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 BB87B5D965; Tue, 29 Aug 2017 16:48:25 +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 211001806106; Tue, 29 Aug 2017 16:48:25 +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 v7TGmNWi008637 for ; Tue, 29 Aug 2017 12:48:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 50144692A7; Tue, 29 Aug 2017 16:48:23 +0000 (UTC) Received: from dnr.brq.redhat.com (unknown [10.34.247.176]) by smtp.corp.redhat.com (Postfix) with ESMTP id CFE51692AD for ; Tue, 29 Aug 2017 16:48:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com DC9724E909 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 29 Aug 2017 18:48:14 +0200 Message-Id: <4b9037fb37527036e916cd3ab25a974df9ad199e.1504025254.git.jtomko@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/4] conf: use virXMLFormatElement for 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 29 Aug 2017 16:48:26 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Simplify the formatting function even further. Reviewed-by: John Ferlan --- src/conf/domain_conf.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 8e555ad9d..a26731e75 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -25061,6 +25061,7 @@ virDomainIOMMUDefFormat(virBufferPtr buf, const virDomainIOMMUDef *iommu) { virBuffer childBuf =3D VIR_BUFFER_INITIALIZER; + virBuffer attrBuf =3D VIR_BUFFER_INITIALIZER; virBuffer driverAttrBuf =3D VIR_BUFFER_INITIALIZER; int ret =3D -1; =20 @@ -25086,16 +25087,11 @@ virDomainIOMMUDefFormat(virBufferPtr buf, if (virXMLFormatElement(&childBuf, "driver", &driverAttrBuf, NULL) < 0) goto cleanup; =20 - virBufferAsprintf(buf, "model)); =20 - if (virBufferError(&childBuf) !=3D 0 || virBufferUse(&childBuf)) { - virBufferAddLit(buf, ">\n"); - virBufferAddBuffer(buf, &childBuf); - virBufferAddLit(buf, "\n"); - } else { - virBufferAddLit(buf, "/>\n"); - } + if (virXMLFormatElement(buf, "iommu", &attrBuf, &childBuf) < 0) + goto cleanup; =20 ret =3D 0; =20 --=20 2.13.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list