From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:53462) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SXx1Y-00073F-Aj for qemu-devel@nongnu.org; Fri, 25 May 2012 12:05:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SXx1W-0007GG-5n for qemu-devel@nongnu.org; Fri, 25 May 2012 12:05:55 -0400 Received: from cantor2.suse.de ([195.135.220.15]:56572 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SXx1V-0007Fn-Sl for qemu-devel@nongnu.org; Fri, 25 May 2012 12:05:54 -0400 Message-ID: <4FBFADDB.2070609@suse.de> Date: Fri, 25 May 2012 18:05:47 +0200 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1337787881-3579-1-git-send-email-pbonzini@redhat.com> <1337787881-3579-4-git-send-email-pbonzini@redhat.com> In-Reply-To: <1337787881-3579-4-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 03/10] qom: push error reporting to object_property_find List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: imammedo@redhat.com, qemu-devel@nongnu.org, Anthony Liguori , peter.maydell@linaro.org Am 23.05.2012 17:44, schrieb Paolo Bonzini: > Signed-off-by: Paolo Bonzini > --- > hw/qdev.c | 2 +- > hw/scsi-bus.c | 2 +- > include/qemu/object.h | 4 +++- > qom/object.c | 22 ++++++++++------------ > 4 files changed, 15 insertions(+), 15 deletions(-) [...] > diff --git a/qom/object.c b/qom/object.c > index 13fd157..68a4c57 100644 > --- a/qom/object.c > +++ b/qom/object.c [...] > @@ -672,12 +672,16 @@ ObjectProperty *object_property_find(Object *obj,= const char *name) > } > } > =20 > + error_set(errp, QERR_PROPERTY_NOT_FOUND, "", name); > return NULL; > } > =20 > void object_property_del(Object *obj, const char *name, Error **errp) > { > - ObjectProperty *prop =3D object_property_find(obj, name); > + ObjectProperty *prop =3D object_property_find(obj, name, errp); > + if (prop =3D=3D NULL) { > + return; > + } > =20 > if (prop =3D=3D NULL) { > error_set(errp, QERR_PROPERTY_NOT_FOUND, "", name); Beep! > @@ -698,10 +702,8 @@ void object_property_del(Object *obj, const char *= name, Error **errp) > void object_property_get(Object *obj, Visitor *v, const char *name, > Error **errp) > { > - ObjectProperty *prop =3D object_property_find(obj, name); > - > + ObjectProperty *prop =3D object_property_find(obj, name, errp); > if (prop =3D=3D NULL) { > - error_set(errp, QERR_PROPERTY_NOT_FOUND, "", name); > return; > } > =20 Currently it doesn't happen, but I wonder if we should check error_is_set(errp) instead of or in addition to prop =3D=3D NULL now? Applies to all callsites above and below. Andreas > @@ -715,10 +717,8 @@ void object_property_get(Object *obj, Visitor *v, = const char *name, > void object_property_set(Object *obj, Visitor *v, const char *name, > Error **errp) > { > - ObjectProperty *prop =3D object_property_find(obj, name); > - > + ObjectProperty *prop =3D object_property_find(obj, name, errp); > if (prop =3D=3D NULL) { > - error_set(errp, QERR_PROPERTY_NOT_FOUND, "", name); > return; > } > =20 > @@ -871,10 +871,8 @@ char *object_property_print(Object *obj, const cha= r *name, > =20 > const char *object_property_get_type(Object *obj, const char *name, Er= ror **errp) > { > - ObjectProperty *prop =3D object_property_find(obj, name); > - > + ObjectProperty *prop =3D object_property_find(obj, name, errp); > if (prop =3D=3D NULL) { > - error_set(errp, QERR_PROPERTY_NOT_FOUND, "", name); > return NULL; > } > =20 > @@ -1057,7 +1055,7 @@ gchar *object_get_canonical_path(Object *obj) > =20 > Object *object_resolve_path_component(Object *parent, gchar *part) > { > - ObjectProperty *prop =3D object_property_find(parent, part); > + ObjectProperty *prop =3D object_property_find(parent, part, NULL); > if (prop =3D=3D NULL) { > return NULL; > } --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg