From bf856b6054d6fb361693f2172005637b219a611b Mon Sep 17 00:00:00 2001 From: Jiri Denemark Date: Wed, 28 Mar 2018 09:01:30 +0200 Subject: [PATCH] util: Introduce virJSONValueObjectStealObject MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jiri Denemark Reviewed-by: Ján Tomko --- src/libvirt_private.syms | 1 + src/util/virjson.c | 8 ++++++++ src/util/virjson.h | 2 ++ 3 files changed, 11 insertions(+) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index cab324c4d7..0918e69525 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2098,6 +2098,7 @@ virJSONValueObjectIsNull; virJSONValueObjectKeysNumber; virJSONValueObjectRemoveKey; virJSONValueObjectStealArray; +virJSONValueObjectStealObject; virJSONValueToString; diff --git a/src/util/virjson.c b/src/util/virjson.c index 3ddefc34ca..dfe00d9280 100644 --- a/src/util/virjson.c +++ b/src/util/virjson.c @@ -1400,6 +1400,14 @@ virJSONValueObjectStealArray(virJSONValuePtr object, const char *key) } +virJSONValuePtr +virJSONValueObjectStealObject(virJSONValuePtr object, + const char *key) +{ + return virJSONValueObjectStealByType(object, key, VIR_JSON_TYPE_OBJECT); +} + + int virJSONValueObjectIsNull(virJSONValuePtr object, const char *key) diff --git a/src/util/virjson.h b/src/util/virjson.h index f7283dcf97..0f098892b4 100644 --- a/src/util/virjson.h +++ b/src/util/virjson.h @@ -112,6 +112,8 @@ virJSONValuePtr virJSONValueObjectGetArray(virJSONValuePtr object, const char *key); virJSONValuePtr virJSONValueObjectStealArray(virJSONValuePtr object, const char *key); +virJSONValuePtr virJSONValueObjectStealObject(virJSONValuePtr object, + const char *key); const char *virJSONValueObjectGetString(virJSONValuePtr object, const char *key); const char *virJSONValueObjectGetStringOrNumber(virJSONValuePtr object, const char *key); -- 2.39.5