1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-16 03:24:31 +03:00
Eric Blake f2acaebd40 json: cope with older yajl semantics
Commit ceb496e5 fails on RHEL 6, with yajl 1.0.7, because that
version of yajl returns yajl_status_insufficient_data when the
parser is waiting for the rest of a token (this enum value was
dropped in yajl 2, so we have to wrap it).  It also exposes a
problem where older yajl silently ignores trailing garbage after
a successful parse, so this patch works around that by changing
the testsuite.  Another more invasive patch can add tighter
semantics to json parsing, but this is sufficient for a minimal
clean backport.

While touching this, fix up our error message cleanup. Yajl
documents that error messages produced by yajl_get_error()
MUST be cleaned with yajl_free_error(); this is certainly
true if we were to pass non-NULL allocator callbacks during
yajl_alloc(), but probably harmless in our usage of passing
NULL.  But better safe than sorry.

* src/util/virjson.c (virJSONValueFromString): Allow different
error code.  Use canonical cleanup of error message.
(VIR_YAJL_STATUS_OK): New helper macro.
* tests/jsontest.c (mymain): Wrap text to avoid difference in
trailing garbage handling

Signed-off-by: Eric Blake <eblake@redhat.com>
2015-06-25 09:11:15 +02:00
..
2014-09-03 09:36:13 -06:00
2015-05-21 18:13:18 +02:00
2012-04-02 09:33:54 -06:00
2015-04-23 17:08:48 -04:00
2015-04-23 17:08:48 -04:00
2015-04-23 17:08:48 -04:00
2015-04-27 16:03:31 +02:00
2014-09-04 15:18:43 -06:00
2013-07-29 13:09:39 -06:00
2015-05-21 18:13:18 +02:00
2013-03-19 13:13:28 -06:00
2015-05-04 15:01:27 +02:00
2015-04-23 17:08:48 -04:00
2014-11-25 08:47:12 -07:00
2013-10-14 10:31:01 +01:00
2015-04-14 19:33:02 +02:00
2015-04-14 19:33:02 +02:00
2014-04-08 11:15:55 +01:00
2015-04-23 17:08:48 -04:00
2015-04-23 17:08:48 -04:00
2015-04-23 17:08:48 -04:00