From nobody Mon Feb 9 01:48:27 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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 170.10.129.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=1638543845; cv=none; d=zohomail.com; s=zohoarc; b=WZoXQxxXOjZ0bMlW2cJhUyM3O9pMLJm3FEx9/irHgHCHqvjWQkEzlHPuJ3QupAMVzfd1EDCPTAhc4b8R+yIAzGNytDGiNGSchljHfsSHa5KiUyov+vD1ZmkKIquutQV2mptjTTRznOKlH8H3Tic/E1AX3AbFVP7j2DnWpe/mRzc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638543845; 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=hpxJlf1F/JVeOGdGOa3yq3bZV/8JyOcRNq2yE9t8PG8=; b=QsVbHQ1Xj+GbRt6Du5pdwNYajfvXSvxnWWaQMaQb079oQvA8Hd/LpuXdd4j4McGPqCIJ67zXV9Wo1ID/wfCD05DEMOFAPzFhQHRQ5bDZN35ea3CAIj+mErrsPMnhymQkyaidUhDwVx0zTh4oIDm2ONcI5qsMDFM74wy7JOeQ1UU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1638543845156963.3539531605177; Fri, 3 Dec 2021 07:04:05 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-439-ielGzzLPMUCLVkBfF3MpNA-1; Fri, 03 Dec 2021 10:04:02 -0500 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 3C94B3E76F; Fri, 3 Dec 2021 15:03:56 +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 20D05694DA; Fri, 3 Dec 2021 15:03:56 +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 EA8CF1802E2B; Fri, 3 Dec 2021 15:03:55 +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 1B3F3tBw031123 for ; Fri, 3 Dec 2021 10:03:55 -0500 Received: by smtp.corp.redhat.com (Postfix) id 692335D9D5; Fri, 3 Dec 2021 15:03:55 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id C01BE5DAA5 for ; Fri, 3 Dec 2021 15:03:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638543844; 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=hpxJlf1F/JVeOGdGOa3yq3bZV/8JyOcRNq2yE9t8PG8=; b=Kt0PeWqKb0XhM7ENwpEPNpOVjJqL6kz8QrxvbF+FgC3Gdr54laGnlAaH37F/fZHypwd9lR OBTi4soyikXITGsYMSmR0wXPP43oBsSrsMXokrRz9gRcoMXNRrOeRw7lcVCw8cg5q/+5sP 0WnxifsjwiQMJI5qp8xhuXDcCF3VqRo= X-MC-Unique: ielGzzLPMUCLVkBfF3MpNA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 05/17] qemuMonitorJSONGraphicsRelocate: Clean up command argument construction Date: Fri, 3 Dec 2021 16:01:44 +0100 Message-Id: <6dd9b3d94fc0c0e3d22b7821e44cb80306593b0f.1638543496.git.pkrempa@redhat.com> 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 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) X-ZM-MESSAGEID: 1638543845668100001 Content-Type: text/plain; charset="utf-8" Move the construction of the command from the variable declaration so that it doesn't exceed the line length and we can also move the logic of determining the protocol outside of the command construction. Signed-off-by: Peter Krempa --- src/qemu/qemu_monitor_json.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 82631e30e0..7cb6795a58 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -3590,17 +3590,20 @@ int qemuMonitorJSONGraphicsRelocate(qemuMonitor *mo= n, int tlsPort, const char *tlsSubject) { - g_autoptr(virJSONValue) cmd =3D qemuMonitorJSONMakeCommand("client_mig= rate_info", - "s:protocol", - (type =3D=3D = VIR_DOMAIN_GRAPHICS_TYPE_SPICE ? "spice" : "vnc"), - "s:hostname",= hostname, - "i:port", por= t, - "i:tls-port",= tlsPort, - "S:cert-subje= ct", tlsSubject, - NULL); + const char *protocol =3D "vnc"; + g_autoptr(virJSONValue) cmd =3D NULL; g_autoptr(virJSONValue) reply =3D NULL; - if (!cmd) + if (type =3D=3D VIR_DOMAIN_GRAPHICS_TYPE_SPICE) + protocol =3D "spice"; + + if (!(cmd =3D qemuMonitorJSONMakeCommand("client_migrate_info", + "s:protocol", protocol, + "s:hostname", hostname, + "i:port", port, + "i:tls-port", tlsPort, + "S:cert-subject", tlsSubject, + NULL))) return -1; if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) --=20 2.31.1