[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: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH v4 29/28] qapi: Add strict mode to JSON output visitor |
Date: |
Fri, 03 Jun 2016 10:36:23 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Eric Blake <address@hidden> writes:
> 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.
I suspect you won't need it if you replace qdict_iter() by
qdict_first(), qdict_next(), and qlist_iter() by QLIST_FOREACH_ENTRY.
- Re: [Qemu-devel] [PATCH v4 29/28] qapi: Add strict mode to JSON output visitor,
Markus Armbruster <=