From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45284) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXV82-0005Je-0W for qemu-devel@nongnu.org; Fri, 26 Sep 2014 09:00:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XXV7x-0005XI-9N for qemu-devel@nongnu.org; Fri, 26 Sep 2014 09:00:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:2153) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXV7x-0005Wl-0V for qemu-devel@nongnu.org; Fri, 26 Sep 2014 09:00:01 -0400 Message-ID: <54256345.1070605@redhat.com> Date: Fri, 26 Sep 2014 14:59:49 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH qom v3 05/14] qom: Allow clearing of a Link property List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Crosthwaite , qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, agraf@suse.de, afaerber@suse.de Il 26/09/2014 07:19, Peter Crosthwaite ha scritto: > By passing in NULL to object_property_set_link. > > The lead user of this is the QDEV GPIO framework which will implement > GPIO disconnects via an "unlink". > > Reviewed-by: Alexander Graf > Signed-off-by: Peter Crosthwaite > --- > > qom/object.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/qom/object.c b/qom/object.c > index da0919a..fe2d1c9 100644 > --- a/qom/object.c > +++ b/qom/object.c > @@ -870,7 +870,7 @@ char *object_property_get_str(Object *obj, const char *name, > void object_property_set_link(Object *obj, Object *value, > const char *name, Error **errp) > { > - gchar *path = object_get_canonical_path(value); > + gchar *path = value ? object_get_canonical_path(value) : NULL; It should also work if you pass an empty string here. If you do this, you do not need patch 4. Paolo > object_property_set_str(obj, path, name, errp); > g_free(path); > } > @@ -1173,7 +1173,7 @@ static void object_set_link_property(Object *obj, Visitor *v, void *opaque, > > visit_type_str(v, &path, name, &local_err); > > - if (!local_err && strcmp(path, "") != 0) { > + if (!local_err && path && strcmp(path, "") != 0) { > new_target = object_resolve_link(obj, name, path, &local_err); > } > >