Re: [Qemu-devel] [PATCH v3 07/18] qapi: Add json output visitor

2016-05-18 Thread Eric Blake
On 05/18/2016 09:16 AM, Eric Blake wrote: >>> +static void json_output_type_any(Visitor *v, const char *name, QObject >>> **obj, >>> + Error **errp) >>> +{ >>> +JsonOutputVisitor *jov = to_jov(v); >>> +QString *str = qobject_to_json(*obj); >>> +assert(s

Re: [Qemu-devel] [PATCH v3 07/18] qapi: Add json output visitor

2016-05-18 Thread Eric Blake
On 05/02/2016 03:15 AM, Markus Armbruster wrote: > Title: s/json/JSON/ > > Eric Blake writes: > >> We have several places that want to go from qapi to JSON; right now, >> they have to create an intermediate QObject to do the work. That >> also has the drawback that the JSON formatting of a QDic

Re: [Qemu-devel] [PATCH v3 07/18] qapi: Add json output visitor

2016-05-09 Thread Eric Blake
On 05/06/2016 08:08 AM, Eric Blake wrote: > On 05/06/2016 06:31 AM, Markus Armbruster wrote: >>> So all that's left are the two output functions. Can we get rid >>> of those, and make Visitor* the only public interface, rather than >>> making every caller have to do upcasts? >> >> The two output

Re: [Qemu-devel] [PATCH v3 07/18] qapi: Add json output visitor

2016-05-06 Thread Eric Blake
On 05/06/2016 06:31 AM, Markus Armbruster wrote: >> So all that's left are the two output functions. Can we get rid >> of those, and make Visitor* the only public interface, rather than >> making every caller have to do upcasts? > > The two output functions are > > QObject *qmp_output_get_q

Re: [Qemu-devel] [PATCH v3 07/18] qapi: Add json output visitor

2016-05-06 Thread Markus Armbruster
Eric Blake writes: > On 05/04/2016 09:45 AM, Markus Armbruster wrote: >> +void json_output_visitor_reset(JsonOutputVisitor *v); > > Hmm. Why is "reset" not a Visitor method? > > I think this would let us put the things enforced by your "qmp: Tighten > output visitor rules

Re: [Qemu-devel] [PATCH v3 07/18] qapi: Add json output visitor

2016-05-05 Thread Eric Blake
On 05/04/2016 09:45 AM, Markus Armbruster wrote: > +void json_output_visitor_reset(JsonOutputVisitor *v); Hmm. Why is "reset" not a Visitor method? I think this would let us put the things enforced by your "qmp: Tighten output visitor rules" in the Visitor contract. >>

Re: [Qemu-devel] [PATCH v3 07/18] qapi: Add json output visitor

2016-05-04 Thread Markus Armbruster
Markus Armbruster writes: > Eric Blake writes: > >> On 05/02/2016 03:15 AM, Markus Armbruster wrote: [...] +/* + * The JSON output visitor does not accept Infinity or NaN to + * visit_type_number(). + */ +JsonOutputVisitor *json_output_visitor_new(void); +void json_

Re: [Qemu-devel] [PATCH v3 07/18] qapi: Add json output visitor

2016-05-03 Thread Markus Armbruster
Eric Blake writes: > On 05/02/2016 03:15 AM, Markus Armbruster wrote: >> Title: s/json/JSON/ >> >> Eric Blake writes: >> >>> We have several places that want to go from qapi to JSON; right now, >>> they have to create an intermediate QObject to do the work. That >>> also has the drawback that

Re: [Qemu-devel] [PATCH v3 07/18] qapi: Add json output visitor

2016-05-02 Thread Eric Blake
On 05/02/2016 03:15 AM, Markus Armbruster wrote: > Title: s/json/JSON/ > > Eric Blake writes: > >> We have several places that want to go from qapi to JSON; right now, >> they have to create an intermediate QObject to do the work. That >> also has the drawback that the JSON formatting of a QDic

Re: [Qemu-devel] [PATCH v3 07/18] qapi: Add json output visitor

2016-05-02 Thread Markus Armbruster
Eric Blake writes: > We have several places that want to go from qapi to JSON; right now, > they have to create an intermediate QObject to do the work. That > also has the drawback that the JSON formatting of a QDict will > rearrange keys (according to a deterministic, but unpredictable, > hash)

Re: [Qemu-devel] [PATCH v3 07/18] qapi: Add json output visitor

2016-05-02 Thread Markus Armbruster
Title: s/json/JSON/ Eric Blake writes: > We have several places that want to go from qapi to JSON; right now, > they have to create an intermediate QObject to do the work. That > also has the drawback that the JSON formatting of a QDict will > rearrange keys (according to a deterministic, but u

[Qemu-devel] [PATCH v3 07/18] qapi: Add json output visitor

2016-04-28 Thread Eric Blake
We have several places that want to go from qapi to JSON; right now, they have to create an intermediate QObject to do the work. That also has the drawback that the JSON formatting of a QDict will rearrange keys (according to a deterministic, but unpredictable, hash), when humans have an easier ti