On Fri, 3 Jun 2011 17:33:08 -0500 Michael Roth <mdr...@linux.vnet.ibm.com> wrote:
> +static void qmp_input_type_int(Visiter *v, int64_t *obj, const char *name, > Error **errp) > +{ > + QmpInputVisiter *qiv = to_qiv(v); > + QObject *qobj = qmp_input_get_object(qiv, name); > + > + if (!qobj || qobject_type(qobj) != QTYPE_QINT) { > + error_set(errp, QERR_INVALID_PARAMETER_TYPE, name, "integer"); > + return; > + } > + > + *obj = qint_get_int(qobject_to_qint(qobj)); Let me warn you for an error I just got: if 'name' is NULL and the if test is true, then error_set() will segfault, because 'name' must not be NULL. So either, we always pass 'name' in the generated code or we automatically build a new string if 'name' is NULL.