From nobody Mon Feb 9 20:36:26 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=1601388962; cv=none; d=zohomail.com; s=zohoarc; b=oKdDU8+qkJQzJ1qSHGXoerMGl49rjyFA9tTXD1XMNFeJP+TF0QEqfQ/KIUqFsYbDN5Gi6OnHPmFm7XifTUkvehVmeF5eBAal6kD5+DKrQ2mZgExoc3cswmpumnTotJuHtGiF6IBbJ7E9kxlEb5pmoqgrB7zGLN08+Aro49vYY3Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601388962; 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=XGWzPJfEen92ONHCr+u8kLIh0DQxsVAWxLg3wEQTbjs=; b=deeqxgrCe0jTOLun3yUSoAMOBinOB4G/GKG3MwTNjW616WDmBvRi5zsal2mluZnLD/48W9HRUTBx1B0X62kiR/5Y4ReUQUG0HxsakfDN58Ng1ZBNUKSSV2ybeZF2+ikD/0YRjWRVE882H7kgqAZ8fyFJKUMfdCm6wZxHoE6pVYw= 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 1601388962657187.63420584590995; Tue, 29 Sep 2020 07:16:02 -0700 (PDT) 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-355-pLoPZQUFNJqqbSYiF-OMtg-1; Tue, 29 Sep 2020 10:15:58 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id ECF0819080D2; Tue, 29 Sep 2020 14:15:50 +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 CC6AC81C40; Tue, 29 Sep 2020 14:15:50 +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 9766B44A5D; Tue, 29 Sep 2020 14:15:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08TEFmQL015203 for ; Tue, 29 Sep 2020 10:15:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id DBEC11001281; Tue, 29 Sep 2020 14:15:48 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 494401002C0C for ; Tue, 29 Sep 2020 14:15:48 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601388961; 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=XGWzPJfEen92ONHCr+u8kLIh0DQxsVAWxLg3wEQTbjs=; b=F4tKoaBA1Rc1TxhYKckqXdPlzhlE1AZ6D+2MGln4F3iImDCKPNzqUSMG5VcvFse7wbpAbt z1Gi4Bm83wUws8shwZwWDWQx18+iJbJaUhTZ9cbH+LJlexghmfhxlpfsqeHTnGwsTsZP8y i0S+ulsZBrAtkpiFzIq7Tdpr3dnguFk= X-MC-Unique: pLoPZQUFNJqqbSYiF-OMtg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 5/6] qemuMigrationCookieXMLFormatStr: Remove Date: Tue, 29 Sep 2020 16:15:35 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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.79 on 10.5.11.13 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" There is just one caller, inline the code. This also optimizes the code as we no longer have to calculate length of the output XML as it's actually stored in the buffer struct. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_migration_cookie.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_coo= kie.c index f5c16a8d16..1596ab914b 100644 --- a/src/qemu/qemu_migration_cookie.c +++ b/src/qemu/qemu_migration_cookie.c @@ -861,20 +861,6 @@ qemuMigrationCookieXMLFormat(virQEMUDriverPtr driver, } -static char * -qemuMigrationCookieXMLFormatStr(virQEMUDriverPtr driver, - virQEMUCapsPtr qemuCaps, - qemuMigrationCookiePtr mig) -{ - g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; - - if (qemuMigrationCookieXMLFormat(driver, qemuCaps, &buf, mig) < 0) - return NULL; - - return virBufferContentAndReset(&buf); -} - - static qemuMigrationCookieGraphicsPtr qemuMigrationCookieGraphicsXMLParse(xmlXPathContextPtr ctxt) { @@ -1397,6 +1383,7 @@ qemuMigrationCookieFormat(qemuMigrationCookiePtr mig, unsigned int flags) { qemuDomainObjPrivatePtr priv =3D dom->privateData; + g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; if (!cookieout || !cookieoutlen) return 0; @@ -1441,10 +1428,11 @@ qemuMigrationCookieFormat(qemuMigrationCookiePtr mi= g, qemuMigrationCookieAddCaps(mig, dom, party) < 0) return -1; - if (!(*cookieout =3D qemuMigrationCookieXMLFormatStr(driver, priv->qem= uCaps, mig))) + if (qemuMigrationCookieXMLFormat(driver, priv->qemuCaps, &buf, mig) < = 0) return -1; - *cookieoutlen =3D strlen(*cookieout) + 1; + *cookieoutlen =3D virBufferUse(&buf) + 1; + *cookieout =3D virBufferContentAndReset(&buf); VIR_DEBUG("cookielen=3D%d cookie=3D%s", *cookieoutlen, *cookieout); --=20 2.26.2