From nobody Mon Feb 9 17:08:07 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=1675354253; cv=none; d=zohomail.com; s=zohoarc; b=bCgw/hCT2eBDHpJirix2gzRWyiqqThOJ4tvfkzJiik7DpcPVqb+t9CgRKKB+NeNVJfiHczDB9KePK+No0BYegV23u4ZC+HOMUupbBLSUTL00B0L8P6qUtHm8K0gsA2+GCBBbNqCGVJHs75VHD0kd/jUgoghp93MHHvEEGWoOSz8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1675354253; 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=LVZQ09YQtCKs3Pigy6IYozRxyM1VgspLHqbgU27beZw=; b=SdwZqUUfumYTHeqRXKBYTZ0pXD5YPSWPzRW7OrCGJyXo8fdhcq5YNjuxjqUnT3HKaF1pSvlJ3NKgw3/2CVPGNB7qiAJNGwf/oQKa+l0AE3KqyQfob4qRkpabEXs5sh6tKqMajejxX6hBDUrN09ND/svPshb4LxyWYomuvdx9HxA= 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 1675354253687593.9400325752783; Thu, 2 Feb 2023 08:10:53 -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-161-crO9cFb4Oj-d857N4xoU4A-1; Thu, 02 Feb 2023 11:10:48 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 689AB1C07565; Thu, 2 Feb 2023 16:10:40 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 51FE5112132D; Thu, 2 Feb 2023 16:10:40 +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 3F62A194658C; Thu, 2 Feb 2023 16:10:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 042191946586 for ; Thu, 2 Feb 2023 16:10:39 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id ECB80404BEC2; Thu, 2 Feb 2023 16:10:38 +0000 (UTC) Received: from speedmetal.lan (ovpn-208-29.brq.redhat.com [10.40.208.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id A705A404BEC0 for ; Thu, 2 Feb 2023 16:10:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675354252; 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=LVZQ09YQtCKs3Pigy6IYozRxyM1VgspLHqbgU27beZw=; b=K5uUdY29w4BLQACfvlb4d6JiGWlj8ixozflvbKnl2bCtBCKREvIIHAlz8//gem4V1czO8z RR4c8kWykPqU7PKB+yaHjUbzHLaBnwFaVEsk0PD+e1Q5i0rZjo3LLcDKOw47x6ey2Ecwig 443XZwQYcL4iXZY+QFbyDcv0ynrlqOo= X-MC-Unique: crO9cFb4Oj-d857N4xoU4A-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 3/5] qemu_monitor_json: Replace simplify fetching Array from JSON object Date: Thu, 2 Feb 2023 17:10:31 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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.3 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: 1675354255060100003 Content-Type: text/plain; charset="utf-8" Replace instances of virJSONValueObjectGet + virJSONValueIsArray by virJSONValueObjectGetArray. Signed-off-by: Peter Krempa --- src/qemu/qemu_monitor_json.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 01e2aaa2cf..d05ca2932f 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -3634,11 +3634,9 @@ qemuMonitorJSONQueryRxFilterParse(virJSONValue *msg, "in query-rx-filter response")); return -1; } - if ((!(table =3D virJSONValueObjectGet(entry, "unicast-table"))) || - (!virJSONValueIsArray(table))) { + if ((!(table =3D virJSONValueObjectGetArray(entry, "unicast-table"))))= { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Missing or invalid 'unicast-table' array " - "in query-rx-filter response")); + _("Missing or invalid 'unicast-table' array in quer= y-rx-filter response")); return -1; } nTable =3D virJSONValueArraySize(table); @@ -3675,11 +3673,9 @@ qemuMonitorJSONQueryRxFilterParse(virJSONValue *msg, "in query-rx-filter response")); return -1; } - if ((!(table =3D virJSONValueObjectGet(entry, "multicast-table"))) || - (!virJSONValueIsArray(table))) { + if ((!(table =3D virJSONValueObjectGetArray(entry, "multicast-table"))= )) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Missing or invalid 'multicast-table' array " - "in query-rx-filter response")); + _("Missing or invalid 'multicast-table' array in qu= ery-rx-filter response")); return -1; } nTable =3D virJSONValueArraySize(table); @@ -3709,11 +3705,9 @@ qemuMonitorJSONQueryRxFilterParse(virJSONValue *msg, "in query-rx-filter response")); return -1; } - if ((!(table =3D virJSONValueObjectGet(entry, "vlan-table"))) || - (!virJSONValueIsArray(table))) { + if ((!(table =3D virJSONValueObjectGetArray(entry, "vlan-table")))) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Missing or invalid 'vlan-table' array " - "in query-rx-filter response")); + _("Missing or invalid 'vlan-table' array in query-r= x-filter response")); return -1; } nTable =3D virJSONValueArraySize(table); @@ -8722,9 +8716,7 @@ qemuMonitorJSONExtractQueryStatsSchema(virJSONValue *= json) if (!virJSONValueIsObject(obj)) continue; - stats =3D virJSONValueObjectGetArray(obj, "stats"); - - if (!virJSONValueIsArray(stats)) + if (!(stats =3D virJSONValueObjectGetArray(obj, "stats"))) continue; target_str =3D virJSONValueObjectGetString(obj, "target"); --=20 2.39.1