Received: from eggs.gnu.org ([2001:4830:134:3::10]:32933) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VtWh9-0005H8-AO for qemu-devel@nongnu.org; Thu, 19 Dec 2013 01:02:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VtWh4-00022J-EC for qemu-devel@nongnu.org; Thu, 19 Dec 2013 01:02:51 -0500 Received: from mx1.redhat.com ([209.132.183.28]:9028) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VtWh4-000229-5s for qemu-devel@nongnu.org; Thu, 19 Dec 2013 01:02:46 -0500 From: Markus Armbruster References: <1387386003-8949-1-git-send-email-lcapitulino@redhat.com> <1387386003-8949-11-git-send-email-lcapitulino@redhat.com> <52B1F2CF.4060400@suse.de> Date: Wed, 18 Dec 2013 20:58:12 +0100 In-Reply-To: <52B1F2CF.4060400@suse.de> ("Andreas =?utf-8?Q?F=C3=A4rber=22?= =?utf-8?Q?'s?= message of "Wed, 18 Dec 2013 20:09:03 +0100") Message-ID: <8761qmrkx7.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PULL 10/13] qom: catch errors in object_property_add_child List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andreas =?utf-8?Q?F=C3=A4rber?= Cc: Paolo Bonzini , Igor Mammedov , qemu-devel@nongnu.org, anthony@codemonkey.ws, Luiz Capitulino Andreas F=C3=A4rber writes: > Am 18.12.2013 18:00, schrieb Luiz Capitulino: >> From: Paolo Bonzini >>=20 >> Signed-off-by: Paolo Bonzini >> Reviewed-By: Igor Mammedov >> Signed-off-by: Luiz Capitulino >> --- >> qom/object.c | 9 +++++++-- >> 1 file changed, 7 insertions(+), 2 deletions(-) >>=20 >> diff --git a/qom/object.c b/qom/object.c >> index fc19cf6..68fe07a 100644 >> --- a/qom/object.c >> +++ b/qom/object.c >> @@ -988,17 +988,22 @@ static void object_finalize_child_property(Object = *obj, const char *name, >> void object_property_add_child(Object *obj, const char *name, >> Object *child, Error **errp) >> { >> + Error *local_err =3D NULL; >> gchar *type; >>=20=20 >> type =3D g_strdup_printf("child<%s>", object_get_typename(OBJECT(ch= ild))); >>=20=20 >> object_property_add(obj, name, type, object_get_child_property, >> - NULL, object_finalize_child_property, child, er= rp); >> - >> + NULL, object_finalize_child_property, child, &l= ocal_err); >> + if (error_is_set(&local_err)) { > > I've been told we shouldn't error_is_set() that way but instead write: > if (local_err) { "if (local_err)" is immediately obvious. "if (error_is_set(&local_err))" isn't. But it's consistent with places where you do "if (error_is_set(errp))", where errp may be null, for whatever that's worth. Obvious is preferable. Anyway, hardly a NAK-worthy crime. [...]