From nobody Mon Feb 9 01:00:54 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1669912333; cv=none; d=zohomail.com; s=zohoarc; b=AZ0kKgFkRyyuJnt3pE8gLN2Mwn4hOnEDt4QC492JNCxYiLUaMLWaoCzNqmh4f4xvfrwtPKEHT80KTPDC652rAUVbmxc3RPqLfkibOyAhZiW0lFFvHrs2PJOQlaMOQDVvbG52emrNgsEhs+mkpE8jSR7EmQPfM5xH9EBChUtUbB4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1669912333; 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=696JjNyTulGkDCUyS4PRT+T+YY/SqG2/yqT8yBkNy8Y=; b=H0NV0dMIg7Zzvds8m2ktps0PydEL85JHuLH9WzUoFEJpEZzfaG2GAEjIMN5LGiemCoJ/0i91atyoxA8g5dR7mLENZ5lmAroBzOPUxyjAeoQwDHJpsi6ihjnJiM2GHquU72+htLi46b+kWK7nOpIeSMRoH4Im85glasjZTzRxytA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1669912333316468.78191782725673; Thu, 1 Dec 2022 08:32:13 -0800 (PST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-395-qJ-I59UtN8ugoa78L3mYOw-1; Thu, 01 Dec 2022 11:31:44 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0AA953813F3F; Thu, 1 Dec 2022 16:31:24 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id D83BE63AED; Thu, 1 Dec 2022 16:31:23 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id CCA9619465A8; Thu, 1 Dec 2022 16:31:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id A42E619465A8 for ; Thu, 1 Dec 2022 16:31:22 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 89C31C154AB; Thu, 1 Dec 2022 16:31:22 +0000 (UTC) Received: from speedmetal.redhat.com (ovpn-208-20.brq.redhat.com [10.40.208.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id DC939C15BB4 for ; Thu, 1 Dec 2022 16:31:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669912332; 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=696JjNyTulGkDCUyS4PRT+T+YY/SqG2/yqT8yBkNy8Y=; b=T2aSw8juuw7whi72QhgW0RDP9/Ns6iRdcEmo8ynaJmZnT8EZNtq79st9xmnTT/yCgWOQtS Iw8G9i0PUZahyigEqpn1cR0RFDDpEIG4RToF98R0HD0CyT2rJXeqgK51NXEk4sJ1Va0K/2 EUAkPNo+Uo+qYktP9wNHTm+SWMM1DpM= X-MC-Unique: qJ-I59UtN8ugoa78L3mYOw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 04/12] qemu: monitor: Use qemuMonitorJSONGetReply when the value is extracted directly Date: Thu, 1 Dec 2022 17:31:08 +0100 Message-Id: <29ce9848150c58792744b20bde545b568aa5d429.1669912195.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 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: 1669912335100100001 Content-Type: text/plain; charset="utf-8" Use qemuMonitorJSONGetReply in cases where qemuMonitorJSONCheckReply is followed by virJSONValueObjectGet*(reply, "return"). Signed-off-by: Peter Krempa --- src/qemu/qemu_monitor_json.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 79729e0a9a..47df4a5160 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -5267,6 +5267,7 @@ qemuMonitorJSONGetCommandLineOptions(qemuMonitor *mon) g_autoptr(GHashTable) ret =3D virHashNew(virJSONValueHashFree); g_autoptr(virJSONValue) cmd =3D NULL; g_autoptr(virJSONValue) reply =3D NULL; + virJSONValue *data; if (!(cmd =3D qemuMonitorJSONMakeCommand("query-command-line-options",= NULL))) return NULL; @@ -5274,10 +5275,10 @@ qemuMonitorJSONGetCommandLineOptions(qemuMonitor *m= on) if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) return NULL; - if (qemuMonitorJSONCheckReply(cmd, reply, VIR_JSON_TYPE_ARRAY) < 0) + if (!(data =3D qemuMonitorJSONGetReply(cmd, reply, VIR_JSON_TYPE_ARRAY= ))) return NULL; - if (virJSONValueArrayForeachSteal(virJSONValueObjectGetArray(reply, "r= eturn"), + if (virJSONValueArrayForeachSteal(data, qemuMonitorJSONGetCommandLineOptions= Worker, ret) < 0) return NULL; @@ -5673,6 +5674,7 @@ qemuMonitorJSONGetDeviceProps(qemuMonitor *mon, g_autoptr(GHashTable) props =3D virHashNew(virJSONValueHashFree); g_autoptr(virJSONValue) cmd =3D NULL; g_autoptr(virJSONValue) reply =3D NULL; + virJSONValue *data; if (!(cmd =3D qemuMonitorJSONMakeCommand("device-list-properties", "s:typename", device, @@ -5686,10 +5688,10 @@ qemuMonitorJSONGetDeviceProps(qemuMonitor *mon, if (qemuMonitorJSONHasError(reply, "DeviceNotFound")) return g_steal_pointer(&props); - if (qemuMonitorJSONCheckReply(cmd, reply, VIR_JSON_TYPE_ARRAY) < 0) + if (!(data =3D qemuMonitorJSONGetReply(cmd, reply, VIR_JSON_TYPE_ARRAY= ))) return NULL; - if (virJSONValueArrayForeachSteal(virJSONValueObjectGetArray(reply, "r= eturn"), + if (virJSONValueArrayForeachSteal(data, qemuMonitorJSONGetDevicePropsWorker, props) < 0) return NULL; @@ -8381,6 +8383,7 @@ qemuMonitorJSONGetCPUMigratable(qemuMonitor *mon, { g_autoptr(virJSONValue) cmd =3D NULL; g_autoptr(virJSONValue) reply =3D NULL; + virJSONValue *data; if (!(cmd =3D qemuMonitorJSONMakeCommand("qom-get", "s:path", cpuQOMPath, @@ -8394,11 +8397,10 @@ qemuMonitorJSONGetCPUMigratable(qemuMonitor *mon, if (qemuMonitorJSONHasError(reply, "GenericError")) return 1; - if (qemuMonitorJSONCheckReply(cmd, reply, VIR_JSON_TYPE_BOOLEAN) < 0) + if (!(data =3D qemuMonitorJSONGetReply(cmd, reply, VIR_JSON_TYPE_BOOLE= AN))) return -1; - return virJSONValueGetBoolean(virJSONValueObjectGet(reply, "return"), - migratable); + return virJSONValueGetBoolean(data, migratable); } --=20 2.38.1