From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43154) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmjXU-0001lc-7V for qemu-devel@nongnu.org; Wed, 21 Sep 2016 11:34:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmjXP-0001yh-00 for qemu-devel@nongnu.org; Wed, 21 Sep 2016 11:34:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47758) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmjXO-0001yT-QR for qemu-devel@nongnu.org; Wed, 21 Sep 2016 11:34:18 -0400 Date: Wed, 21 Sep 2016 16:34:14 +0100 From: "Daniel P. Berrange" Message-ID: <20160921153414.GW15535@redhat.com> Reply-To: "Daniel P. Berrange" References: <20160921103629.6410-1-marcandre.lureau@redhat.com> <20160921103629.6410-3-marcandre.lureau@redhat.com> <20160921144158.GT15535@redhat.com> <1436395991.478799.1474471065062.JavaMail.zimbra@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1436395991.478799.1474471065062.JavaMail.zimbra@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 2/3] qapi: clear given pointer List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?utf-8?Q?Marc-Andr=C3=A9?= Lureau Cc: =?utf-8?Q?Marc-Andr=C3=A9?= Lureau , qemu-devel@nongnu.org, berto@igalia.com, armbru@redhat.com On Wed, Sep 21, 2016 at 11:17:45AM -0400, Marc-Andr=C3=A9 Lureau wrote: > Hi >=20 > ----- Original Message ----- > > On Wed, Sep 21, 2016 at 02:36:28PM +0400, Marc-Andr=C3=A9 Lureau wrot= e: > > > Some getters already set *obj argument to NULL early, let's do this= for > > > all for consistent behaviour in case of errors. > > >=20 > > > Signed-off-by: Marc-Andr=C3=A9 Lureau > >=20 > > If we want consistent behaviour, there's plenty more visit methods > > that need updating beyond these two. eg input_type_int64 will > > leave '*obj' untouched on error. > >=20 > > In fact if we want to have '*obj' given a NULL value on error, > > then it seems we should instead add code to 'qapi-visit-core.c' > > to always initialize '*obj' to NULL, instead of doing it in > > qmp-input-visitor.c That way all visitor implementations get > > the same behaviour >=20 > I think that's not easily doable, as an input visitor will want to set = *obj (to NULL or something), but the output visitor may need *obj !=3D NU= LL as an input. Oh good point. > It'snot really elegant that there is visitor-input/output specific code= already in the visit-core, I would rather have that code in the respecti= ve visitors. Also, my series of visitor patches will delete opts-visitor and string-input-visitor, so ultimately qmp-input-visitor will be the only one left doing input work. Regards, Daniel --=20 |: http://berrange.com -o- http://www.flickr.com/photos/dberrange= / :| |: http://libvirt.org -o- http://virt-manager.or= g :| |: http://autobuild.org -o- http://search.cpan.org/~danberr= / :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vn= c :|