[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v4 29/28] qapi: Add strict mode to JSON output v
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v4 29/28] qapi: Add strict mode to JSON output visitor |
Date: |
Thu, 19 May 2016 14:18:01 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
On 05/19/2016 10:52 AM, Eric Blake wrote:
> Let the caller decide whether output must be strict JSON (and
> raise an error on an attempt to output an encoding error or
> non-finite number), vs. the status quo of relaxed (encoding
> errors are rewritten to use substitute U+fffd characters,
> and non-finite numbers are output).
>
> Adjust the testsuite to cover this: check-qobject-json checks
> relaxed mode (since qobject_to_json() is unchanged in behavior),
> test-qmp-output-visitor checks that QObject doesn't care about
> JSON restrictions, and test-json-output-visitor is now in
> strict mode and flags the errors.
>
> Signed-off-by: Eric Blake <address@hidden>
>
> +++ b/qobject/qobject-json.c
> @@ -72,62 +72,81 @@ QObject *qobject_from_jsonf(const char *string, ...)
> return obj;
> }
>
> +typedef struct ToJson {
> +{
> + Visitor *v;
Uggh, posted the wrong version. checkpatch complained the { was on the
wrong line, so I added it in the right one and then pushed before
re-saving after deleting the duplicate one.
Actually, if this patch is worthwhile, I'm thinking that in v5, I'll
minimize some of the churn and keep the ToJsonIterState struct that I
removed in 26/28, even if it only has a single 'Visitor *v' member at
that time, rather than completely removing it there to reinstate it here.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH v4 27/28] qapi: Add 'any' support to JSON output, (continued)
- [Qemu-devel] [PATCH v4 27/28] qapi: Add 'any' support to JSON output, Eric Blake, 2016/05/19
- [Qemu-devel] [PATCH v4 20/28] qstring: Add qstring_consume_str(), Eric Blake, 2016/05/19
- [Qemu-devel] [PATCH v4 24/28] qapi: Add JSON output visitor, Eric Blake, 2016/05/19
- [Qemu-devel] [PATCH v4 22/28] qobject: Consolidate qobject_to_json() calls, Eric Blake, 2016/05/19
- [Qemu-devel] [PATCH v4 28/28] qemu-img: Use new JSON output formatter, Eric Blake, 2016/05/19
- [Qemu-devel] [PATCH v4 19/28] qapi: Use qstring_append_chr() where appropriate, Eric Blake, 2016/05/19
- [Qemu-devel] [PATCH v4 12/28] qapi: Add new visit_complete() function, Eric Blake, 2016/05/19
- [Qemu-devel] [PATCH v4 21/28] qstring: Add qstring_wrap_str(), Eric Blake, 2016/05/19
- Re: [Qemu-devel] [PATCH v4 00/28] Add qapi-to-JSON and clone visitors, Eric Blake, 2016/05/19
- [Qemu-devel] [PATCH v4 29/28] qapi: Add strict mode to JSON output visitor, Eric Blake, 2016/05/19
- Re: [Qemu-devel] [PATCH v4 29/28] qapi: Add strict mode to JSON output visitor,
Eric Blake <=
- Re: [Qemu-devel] [PATCH v4 00/28] Add qapi-to-JSON and clone visitors, Markus Armbruster, 2016/05/19