Eric Blake <ebl...@redhat.com> writes: > On 04/02/2015 11:29 AM, Markus Armbruster wrote: >> I'm going to fix the JSON parser to recognize null. The obvious >> representation of JSON null as (QObject *)NULL doesn't work, because >> the parser already uses it as an error value. Perhaps we should >> change it to free NULL for null, but that's more than I can do right >> now. Create a special null QObject instead. >> >> Signed-off-by: Markus Armbruster <arm...@redhat.com> >> --- >> include/qapi/qmp/qobject.h | 9 +++++++++ >> qobject/Makefile.objs | 2 +- >> qobject/qjson.c | 3 +++ >> qobject/qnull.c | 29 +++++++++++++++++++++++++++++ >> 4 files changed, 42 insertions(+), 1 deletion(-) >> create mode 100644 qobject/qnull.c >> > >> +static const QType qnull_type = { >> + .code = QTYPE_QINT, > > s/QINT/QNULL/
Oww. >> + .destroy = qnull_destroy_obj, >> +}; >> + >> +QObject qnull_ = { >> + .type = &qnull_type, >> + .refcnt = 1 >> +}; > > Worth a trailing comma in the initializer? Unlikely to require more initializers, but I don't mind. Conflicts with your "qapi: Accept 'null' in QMP". Current plan: you pick the best of both into a new series.