summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Krempa <pkrempa@redhat.com>2018-03-20 14:07:26 +0100
committerPeter Krempa <pkrempa@redhat.com>2018-03-23 14:52:07 +0100
commit57cd22bc54e0220b6d36555c19cdfa2a65fa232b (patch)
tree5d6a9fc2c88839258938c24b1f7d57219fedd4fb
parent38b3b20c66086a2ebcd4e74c99f94123f0e1f2e7 (diff)
downloadlibvirt-57cd22bc54e0220b6d36555c19cdfa2a65fa232b.tar.gz
util: json: Add accessor for looking up JSON value type
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
-rw-r--r--src/libvirt_private.syms1
-rw-r--r--src/util/virjson.c7
-rw-r--r--src/util/virjson.h2
3 files changed, 10 insertions, 0 deletions
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)