All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Cc: qemu-devel@nongnu.org, berto@igalia.com
Subject: Re: [Qemu-devel] [PATCH 2/3] qapi: clear given pointer
Date: Wed, 21 Sep 2016 17:24:06 +0200	[thread overview]
Message-ID: <874m59xomh.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <20160921103629.6410-3-marcandre.lureau@redhat.com> ("Marc-André Lureau"'s message of "Wed, 21 Sep 2016 14:36:28 +0400")

Marc-André Lureau <marcandre.lureau@redhat.com> writes:

> Some getters already set *obj argument to NULL early, let's do this for
> all for consistent behaviour in case of errors.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  qapi/qmp-input-visitor.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/qapi/qmp-input-visitor.c b/qapi/qmp-input-visitor.c
> index ea9972d..cb9d196 100644
> --- a/qapi/qmp-input-visitor.c
> +++ b/qapi/qmp-input-visitor.c
> @@ -322,11 +322,13 @@ static void qmp_input_type_str(Visitor *v, const char *name, char **obj,
>      QObject *qobj = qmp_input_get_object(qiv, name, true, errp);
>      QString *qstr = qobject_to_qstring(qobj);
>  
> +    if (obj) {
> +        *obj = NULL;
> +    }
>      if (!qobj) {
>          return;
>      }
>      if (!qstr) {
> -        *obj = NULL;
>          error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
>                     "string");
>          return;

This undoes damage done in PATCH 1.

> @@ -368,6 +370,9 @@ static void qmp_input_type_any(Visitor *v, const char *name, QObject **obj,
>      QmpInputVisitor *qiv = to_qiv(v);
>      QObject *qobj = qmp_input_get_object(qiv, name, true, errp);
>  
> +    if (obj) {
> +        *obj = NULL;
> +    }
>      if (!qobj) {
>          return;
>      }

Likewise.

Similar damage done to qmp_input_start_list() and possibly others.
Please squash into PATCH 1 and double-check your new error returns affect
*obj like the existing ones.

  parent reply	other threads:[~2016-09-21 15:24 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-21 10:36 [Qemu-devel] [PATCH 0/3] qapi: return 'missing parameter' error Marc-André Lureau
2016-09-21 10:36 ` [Qemu-devel] [PATCH 1/3] qapi: return a " Marc-André Lureau
2016-09-21 12:57   ` Alberto Garcia
2016-09-21 14:33   ` Markus Armbruster
2016-09-21 15:05     ` Marc-André Lureau
2016-09-21 16:07     ` Marc-André Lureau
2016-09-22 11:02       ` Markus Armbruster
2016-09-21 10:36 ` [Qemu-devel] [PATCH 2/3] qapi: clear given pointer Marc-André Lureau
2016-09-21 12:57   ` Alberto Garcia
2016-09-21 14:41   ` Daniel P. Berrange
2016-09-21 15:17     ` Marc-André Lureau
2016-09-21 15:34       ` Daniel P. Berrange
2016-09-21 15:24   ` Markus Armbruster [this message]
2016-09-21 10:36 ` [Qemu-devel] [PATCH 3/3] iotests: fix expected error message Marc-André Lureau
2016-09-21 12:58   ` Alberto Garcia
2016-09-21 15:14   ` Markus Armbruster
2016-09-21 15:32     ` Marc-André Lureau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874m59xomh.fsf@dusky.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=berto@igalia.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.