From nobody Sun Feb 8 20:53:42 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1498567869807270.6425092353138; Tue, 27 Jun 2017 05:51:09 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id CDF507F409; Tue, 27 Jun 2017 12:51:06 +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 79EEB87108; Tue, 27 Jun 2017 12:51:06 +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 F32B93FADE; Tue, 27 Jun 2017 12:51:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v5RCl0dq023761 for ; Tue, 27 Jun 2017 08:47:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2269B8A781; Tue, 27 Jun 2017 12:47:00 +0000 (UTC) Received: from andariel.redhat.com (ovpn-204-24.brq.redhat.com [10.40.204.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id 93D068A472; Tue, 27 Jun 2017 12:46:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com CDF507F409 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com CDF507F409 From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 27 Jun 2017 14:46:43 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 2/9] util: json: Add virJSONValueIsObject 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 27 Jun 2017 12:51:07 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Allows testing whether a virJSONValue is an object. Reviewed-by: John Ferlan --- src/libvirt_private.syms | 1 + src/util/virjson.c | 10 ++++++++++ src/util/virjson.h | 2 ++ 3 files changed, 13 insertions(+) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index c1e9471c5..d487b1f43 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1905,6 +1905,7 @@ virJSONValueGetString; virJSONValueHashFree; virJSONValueIsArray; virJSONValueIsNull; +virJSONValueIsObject; virJSONValueNewArray; virJSONValueNewArrayFromBitmap; virJSONValueNewBoolean; diff --git a/src/util/virjson.c b/src/util/virjson.c index b49b29b0f..efd6c3a0e 100644 --- a/src/util/virjson.c +++ b/src/util/virjson.c @@ -905,6 +905,16 @@ virJSONValueObjectGetValue(virJSONValuePtr object, bool +virJSONValueIsObject(virJSONValuePtr object) +{ + if (object) + return object->type =3D=3D VIR_JSON_TYPE_OBJECT; + else + return NULL; +} + + +bool virJSONValueIsArray(virJSONValuePtr array) { return array->type =3D=3D VIR_JSON_TYPE_ARRAY; diff --git a/src/util/virjson.h b/src/util/virjson.h index 14b74c061..c9d9752de 100644 --- a/src/util/virjson.h +++ b/src/util/virjson.h @@ -114,6 +114,8 @@ virJSONValuePtr virJSONValueObjectGet(virJSONValuePtr o= bject, const char *key); virJSONValuePtr virJSONValueObjectGetByType(virJSONValuePtr object, const char *key, virJSONType t= ype); +bool virJSONValueIsObject(virJSONValuePtr object); + bool virJSONValueIsArray(virJSONValuePtr array); ssize_t virJSONValueArraySize(const virJSONValue *array); virJSONValuePtr virJSONValueArrayGet(virJSONValuePtr object, unsigned int = element); --=20 2.12.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list