qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2][ 10/21] qapi: add QMP input visiter


From: Luiz Capitulino
Subject: Re: [Qemu-devel] [PATCH v2][ 10/21] qapi: add QMP input visiter
Date: Mon, 13 Jun 2011 16:12:49 -0300

On Fri,  3 Jun 2011 17:33:08 -0500
Michael Roth <address@hidden> 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]