From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39443) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmjI7-0007CM-7I for qemu-devel@nongnu.org; Wed, 21 Sep 2016 11:18:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmjI3-00008e-6N for qemu-devel@nongnu.org; Wed, 21 Sep 2016 11:18:31 -0400 Received: from mx3-phx2.redhat.com ([209.132.183.24]:56188) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmjI2-00007l-Sf for qemu-devel@nongnu.org; Wed, 21 Sep 2016 11:18:27 -0400 Date: Wed, 21 Sep 2016 11:17:45 -0400 (EDT) From: =?utf-8?Q?Marc-Andr=C3=A9?= Lureau Message-ID: <1436395991.478799.1474471065062.JavaMail.zimbra@redhat.com> In-Reply-To: <20160921144158.GT15535@redhat.com> References: <20160921103629.6410-1-marcandre.lureau@redhat.com> <20160921103629.6410-3-marcandre.lureau@redhat.com> <20160921144158.GT15535@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 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: "Daniel P. Berrange" Cc: =?utf-8?Q?Marc-Andr=C3=A9?= Lureau , qemu-devel@nongnu.org, berto@igalia.com, armbru@redhat.com Hi ----- Original Message ----- > On Wed, Sep 21, 2016 at 02:36:28PM +0400, Marc-Andr=C3=A9 Lureau wrote: > > 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 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 NULL as = an input. It'snot really elegant that there is visitor-input/output specific code alr= eady in the visit-core, I would rather have that code in the respective vis= itors. >=20 > Alternatively, we could say that '*obj' should never be touched > on error paths, in which case we've a bunchof cleanup todo > in qmp_input_visitor to avoid splattering *obj. >=20 > Regards, > Daniel > -- > |: 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 :| >=20