From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51040) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8kam-0003ho-6D for qemu-devel@nongnu.org; Fri, 03 Jun 2016 04:36:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b8kal-0006ej-7q for qemu-devel@nongnu.org; Fri, 03 Jun 2016 04:36:32 -0400 From: Markus Armbruster References: <1463632874-28559-1-git-send-email-eblake@redhat.com> <1463676743-22133-1-git-send-email-eblake@redhat.com> <573E1F79.9020307@redhat.com> Date: Fri, 03 Jun 2016 10:36:23 +0200 In-Reply-To: <573E1F79.9020307@redhat.com> (Eric Blake's message of "Thu, 19 May 2016 14:18:01 -0600") Message-ID: <877fe6654o.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v4 29/28] qapi: Add strict mode to JSON output visitor List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: qemu-devel@nongnu.org, Kevin Wolf , "open list:Block layer core" , Michael Roth , Luiz Capitulino , Max Reitz Eric Blake 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 >> > >> +++ 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.