On 07/01/2015 02:22 PM, Markus Armbruster wrote: > With the previous commit, the generated marshalers just work, and save > us a bit of handwritten code. >
Generated code grows, because you are now generating the hook :) qmp-commands.h | 6 ++ qmp-marshal.c | 144 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 150 insertions(+) > Signed-off-by: Markus Armbruster <arm...@redhat.com> > --- > include/monitor/monitor.h | 3 --- > qapi-schema.json | 9 +++------ > qmp-commands.hx | 6 +++--- > qmp.c | 20 +++++++------------- > scripts/qapi.py | 1 + > 5 files changed, 14 insertions(+), 25 deletions(-) > > +++ b/qmp.c > @@ -229,11 +229,9 @@ ObjectPropertyInfoList *qmp_qom_list(const char *path, > Error **errp) > } > > /* FIXME: teach qapi about how to pass through Visitors */ > -void qmp_qom_set(QDict *qdict, QObject **ret, Error **errp) > +void qmp_qom_set(const char *path, const char *property, QObject *value, > + Error **errp) The FIXME seems stale now. > > -void qmp_object_add(QDict *qdict, QObject **ret, Error **errp) > +void qmp_object_add(const char *type, const char *id, > + bool has_props, QObject *props, Error **errp) > { > - const char *type = qdict_get_str(qdict, "qom-type"); > - const char *id = qdict_get_str(qdict, "id"); > - QObject *props = qdict_get(qdict, "props"); > const QDict *pdict = NULL; > QmpInputVisitor *qiv; > Continuing: if (props) { pdict = qobject_to_qdict(props); if (!pdict) { error_setg(errp, QERR_INVALID_PARAMETER_TYPE, "props", "dict"); return; } } I know that we guarantee that all pointers are initialized to NULL in our marshaler, so this is correct; but wouldn't it be more idiomatic to write 'if (has_props)' as the condition? (And it would make a nice followup project for someone to figure out how to get rid of have_FOO arguments for strings and objects where NULL is a nice witness; it is only integers and booleans that require them - but doing that will touch a lot of the tree, and is a series of its own) What I pointed out is minor, so you can fix it and add: Reviewed-by: Eric Blake <ebl...@redhat.com> -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature