From nobody Sun Feb 8 15:53:35 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1606999030; cv=none; d=zohomail.com; s=zohoarc; b=m9evmuiY8G9yttweFggMd8Zyo32w02br2NgbaYFEaEd9O+k3qc1yTJixi2UFoFtC/9u2kZE06D3BkRx4aRwpvdxx0hZEQgfSe+dBScUtY3NGrmaCtn1IYX9BOir4Aak/MoKTnEzEurjqvU0dyDVMzgkOBRDlarGtcCup1kR43Ws= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606999030; 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=uF1a+w6Gp2KBOhe18zgtYuDiqL+FYEgQJO/1TwZixMQ=; b=EgHmDo6RTySJDMDgmuqrPUsFwZH7WQ7UzSHF8slRscZk13e0UUYXPHX3MZb/sgLb+wWJuOcxDBMnNA5BlVxw+g1CVywbIQxYKYfzU/nnEtYYRTHYe/OuUYPFbRVHBGkxYjJi+wPykidywTLxQ/skkMzOJkoAdFcum1hGhyzp5gQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1606999030527678.3025443364807; Thu, 3 Dec 2020 04:37:10 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-364-_OIcellcOb6xY5VE1EG1Pg-1; Thu, 03 Dec 2020 07:37:06 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 18BDC1081B24; Thu, 3 Dec 2020 12:37:00 +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 E8E411A8A0; Thu, 3 Dec 2020 12:36:59 +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 B06895002F; Thu, 3 Dec 2020 12:36:59 +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 0B3CavqW002999 for ; Thu, 3 Dec 2020 07:36:57 -0500 Received: by smtp.corp.redhat.com (Postfix) id DACC95C1CF; Thu, 3 Dec 2020 12:36:57 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.192.239]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5BCD35C1C2 for ; Thu, 3 Dec 2020 12:36:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606999029; 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=uF1a+w6Gp2KBOhe18zgtYuDiqL+FYEgQJO/1TwZixMQ=; b=gf5v7+DNGZVm53T+05sbFkub2Vhx5whfq2zQ0SRU564Ti5DU8hlhBkg9qatB1aC4l+EJEh qe1SGIoNJIgK5avFrvvC/1h+w5HDIEiZXLHO1HrQrTIlYZuiF4+kdk1xLuKsRQFLOvsJK8 vNfoCIcsWPSR28f4jGZ6ZcZuPKNVSBw= X-MC-Unique: _OIcellcOb6xY5VE1EG1Pg-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v2 09/27] virDomainMemoryTargetDefFormat: Utilize virXMLFormatElement() Date: Thu, 3 Dec 2020 13:36:12 +0100 Message-Id: <0e0d5bfd577ff5ee3c30b9b8c97346e8e5a3cacf.1606998426.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.23 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) Content-Type: text/plain; charset="utf-8" The virDomainMemoryTargetDefFormat() uses good old style of formatting child buffer (virBufferAdjustIndent()). When switched to virXMLFormatElement() we can save a couple of lines Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- src/conf/domain_conf.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index bb0d9f4501..7d9e5d14ad 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -27882,24 +27882,21 @@ static void virDomainMemoryTargetDefFormat(virBufferPtr buf, virDomainMemoryDefPtr def) { - virBufferAddLit(buf, "\n"); - virBufferAdjustIndent(buf, 2); + g_auto(virBuffer) childBuf =3D VIR_BUFFER_INIT_CHILD(buf); =20 - virBufferAsprintf(buf, "%llu\n", def->size); + virBufferAsprintf(&childBuf, "%llu\n", def->= size); if (def->targetNode >=3D 0) - virBufferAsprintf(buf, "%d\n", def->targetNode); + virBufferAsprintf(&childBuf, "%d\n", def->targetNode); if (def->labelsize) { - virBufferAddLit(buf, "\n"); + g_auto(virBuffer) labelChildBuf =3D VIR_BUFFER_INIT_CHILD(&childBu= f); + + virBufferAsprintf(&labelChildBuf, "%llu\= n", def->labelsize); + virXMLFormatElement(&childBuf, "label", NULL, &labelChildBuf); } if (def->readonly) - virBufferAddLit(buf, "\n"); + virBufferAddLit(&childBuf, "\n"); =20 - virBufferAdjustIndent(buf, -2); - virBufferAddLit(buf, "\n"); + virXMLFormatElement(buf, "target", NULL, &childBuf); } =20 static int --=20 2.26.2