From nobody Mon Feb 9 11:31:48 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1606489501; cv=none; d=zohomail.com; s=zohoarc; b=a8FNTkbCstbuX24cD15FhalfWCeQvLd0egIkWwjmJVpD8F8IOnpnb50VlzVSrypeYYJ65RRi0Fm/tBmdvx4cq3kTiSN35zXyFJIpef4hudItHdM7Sz01SdqSsYzqp0esQWzpmC8NuwxzFX3QqxFVFCjDYj1u1zbGXIGXtV0OSCA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606489501; 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=X1pZG62Z+yC4VTnTyuHB9EYLwsYNyJRHP5fHwijvcIE=; b=SM3ekBPWVJcN7u2sg6ZG4uiYfHnB+XjtH2EaBZZWPPgM1Qe7mT9fKoic0dTibs3QHlUuRG8OCMB4roEoqrMOpSxFNpYP+3A3FiJxlbjd2r9hXA2S08HfQlGOJyr/1pw1wWRjmM4tbDLN3xkd4ceFznZRSB/6tsSlkS7GrfNZBOQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1606489501389246.92666278391835; Fri, 27 Nov 2020 07:05:01 -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-165-qTnpihQMPMyZzgis2_xyGg-1; Fri, 27 Nov 2020 10:04:57 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 47DF3185E498; Fri, 27 Nov 2020 15:04:51 +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 225455D720; Fri, 27 Nov 2020 15:04:51 +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 DE3261809CA9; Fri, 27 Nov 2020 15:04:50 +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 0ARF4mAA030843 for ; Fri, 27 Nov 2020 10:04:48 -0500 Received: by smtp.corp.redhat.com (Postfix) id 23E5E5D9E4; Fri, 27 Nov 2020 15:04:48 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.195.47]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5AD2A5D9E2; Fri, 27 Nov 2020 15:04:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606489499; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=X1pZG62Z+yC4VTnTyuHB9EYLwsYNyJRHP5fHwijvcIE=; b=E5wNROqrEAB3zIjX8JYpknXOgg8XK04fnN0JT7Kl4Ftljz8s/n5AUN0MPu07aKKsVnukRz CqdDKCf51y6cpjIaUka0wH6YpcuDbcL1R6oj6/91jTnp/cjeq5CneKSMy45FBiC6pF7GAd M577uLJvCM4grN9aT64ETWrRw96DaAk= X-MC-Unique: qTnpihQMPMyZzgis2_xyGg-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v1 09/26] virDomainMemoryTargetDefFormat: Utilize virXMLFormatElement() Date: Fri, 27 Nov 2020 16:02:55 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: david@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.15 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 --- 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 8f10fe14d3..c4da972f1a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -27920,24 +27920,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