[libvirt] [PATCH 05/11] util: json: Add accessor for looking up JSON value type

Peter Krempa pkrempa at redhat.com
Thu Mar 22 18:31:42 UTC 2018


Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/libvirt_private.syms | 1 +
 src/util/virjson.c       | 7 +++++++
 src/util/virjson.h       | 2 ++
 3 files changed, 10 insertions(+)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index c3e4fd23df..03fe3b315f 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2041,6 +2041,7 @@ virJSONValueGetNumberLong;
 virJSONValueGetNumberUint;
 virJSONValueGetNumberUlong;
 virJSONValueGetString;
+virJSONValueGetType;
 virJSONValueHashFree;
 virJSONValueIsArray;
 virJSONValueIsNull;
diff --git a/src/util/virjson.c b/src/util/virjson.c
index 14b68b8c93..6a02ddf0cc 100644
--- a/src/util/virjson.c
+++ b/src/util/virjson.c
@@ -68,6 +68,13 @@ struct _virJSONParser {
 };


+virJSONType
+virJSONValueGetType(const virJSONValue *value)
+{
+    return value->type;
+}
+
+
 /**
  * virJSONValueObjectAddVArgs:
  * @obj: JSON object to add the values to
diff --git a/src/util/virjson.h b/src/util/virjson.h
index b76a3c3472..017a1f20ed 100644
--- a/src/util/virjson.h
+++ b/src/util/virjson.h
@@ -83,6 +83,8 @@ struct _virJSONValue {
 void virJSONValueFree(virJSONValuePtr value);
 void virJSONValueHashFree(void *opaque, const void *name);

+virJSONType virJSONValueGetType(const virJSONValue *value);
+
 int virJSONValueObjectCreate(virJSONValuePtr *obj, ...)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_SENTINEL;
 int virJSONValueObjectCreateVArgs(virJSONValuePtr *obj, va_list args)
-- 
2.16.2




More information about the libvir-list mailing list