From a2a04524be7cde69b18e8145e285580fae5f4455 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Tue, 26 Mar 2019 17:56:14 +0100 Subject: [PATCH] util: json: Export virJSONValueToBuffer Signed-off-by: Peter Krempa Reviewed-by: Laine Stump --- src/libvirt_private.syms | 1 + src/util/virjson.c | 4 ++-- src/util/virjson.h | 5 +++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 46e5ad34e3..23cbd27ce1 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2204,6 +2204,7 @@ virJSONValueObjectKeysNumber; virJSONValueObjectRemoveKey; virJSONValueObjectStealArray; virJSONValueObjectStealObject; +virJSONValueToBuffer; virJSONValueToString; diff --git a/src/util/virjson.c b/src/util/virjson.c index 19857d2f2f..c519f8139e 100644 --- a/src/util/virjson.c +++ b/src/util/virjson.c @@ -1970,7 +1970,7 @@ virJSONValueToStringOne(virJSONValuePtr object, } -static int +int virJSONValueToBuffer(virJSONValuePtr object, virBufferPtr buf, bool pretty) @@ -2031,7 +2031,7 @@ virJSONValueFromString(const char *jsonstring ATTRIBUTE_UNUSED) } -static int +int virJSONValueToBuffer(virJSONValuePtr object ATTRIBUTE_UNUSED, virBufferPtr buf ATTRIBUTE_UNUSED, bool pretty ATTRIBUTE_UNUSED) diff --git a/src/util/virjson.h b/src/util/virjson.h index 3dee103aba..ec86603794 100644 --- a/src/util/virjson.h +++ b/src/util/virjson.h @@ -26,6 +26,7 @@ # include "internal.h" # include "virbitmap.h" # include "viralloc.h" +# include "virbuffer.h" # include @@ -143,6 +144,10 @@ int virJSONValueArrayAppendString(virJSONValuePtr object, const char *value); virJSONValuePtr virJSONValueFromString(const char *jsonstring); char *virJSONValueToString(virJSONValuePtr object, bool pretty); +int virJSONValueToBuffer(virJSONValuePtr object, + virBufferPtr buf, + bool pretty) + ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK; typedef int (*virJSONValueObjectIteratorFunc)(const char *key, virJSONValuePtr value, -- GitLab