libvirt/63f6e0e9-revert-jansson9.patch

74 lines
2.2 KiB
Diff
Raw Normal View History

commit 63f6e0e95036a0634ee8147ee7a463c4066fa720
Author: Ján Tomko <jtomko@redhat.com>
Date: Mon Aug 13 13:39:56 2018 +0200
Revert "Remove virJSONValueNewStringLen"
This reverts commit 8f802c6d8659beb9eb3cab96ba2553e251728337.
Jansson cannot parse QEMU's quirky JSON.
Revert back to yajl.
https://bugzilla.redhat.com/show_bug.cgi?id=1614569
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Index: libvirt-4.6.0/src/libvirt_private.syms
===================================================================
--- libvirt-4.6.0.orig/src/libvirt_private.syms
+++ libvirt-4.6.0/src/libvirt_private.syms
@@ -2098,6 +2098,7 @@ virJSONValueNewNumberUint;
virJSONValueNewNumberUlong;
virJSONValueNewObject;
virJSONValueNewString;
+virJSONValueNewStringLen;
virJSONValueObjectAdd;
virJSONValueObjectAddVArgs;
virJSONValueObjectAppend;
Index: libvirt-4.6.0/src/util/virjson.c
===================================================================
--- libvirt-4.6.0.orig/src/util/virjson.c
+++ libvirt-4.6.0/src/util/virjson.c
@@ -420,6 +420,28 @@ virJSONValueNewString(const char *data)
}
+virJSONValuePtr
+virJSONValueNewStringLen(const char *data,
+ size_t length)
+{
+ virJSONValuePtr val;
+
+ if (!data)
+ return virJSONValueNewNull();
+
+ if (VIR_ALLOC(val) < 0)
+ return NULL;
+
+ val->type = VIR_JSON_TYPE_STRING;
+ if (VIR_STRNDUP(val->data.string, data, length) < 0) {
+ VIR_FREE(val);
+ return NULL;
+ }
+
+ return val;
+}
+
+
static virJSONValuePtr
virJSONValueNewNumber(const char *data)
{
Index: libvirt-4.6.0/src/util/virjson.h
===================================================================
--- libvirt-4.6.0.orig/src/util/virjson.h
+++ libvirt-4.6.0/src/util/virjson.h
@@ -59,6 +59,7 @@ int virJSONValueObjectAddVArgs(virJSONVa
virJSONValuePtr virJSONValueNewString(const char *data);
+virJSONValuePtr virJSONValueNewStringLen(const char *data, size_t length);
virJSONValuePtr virJSONValueNewNumberInt(int data);
virJSONValuePtr virJSONValueNewNumberUint(unsigned int data);
virJSONValuePtr virJSONValueNewNumberLong(long long data);