Received: from eggs.gnu.org ([2001:4830:134:3::10]:58499) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXVn6-0002fk-7s for qemu-devel@nongnu.org; Fri, 26 Sep 2014 09:42:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XXVn0-0002Pu-Hy for qemu-devel@nongnu.org; Fri, 26 Sep 2014 09:42:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56249) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXVn0-0002JT-8C for qemu-devel@nongnu.org; Fri, 26 Sep 2014 09:42:26 -0400 Date: Fri, 26 Sep 2014 15:42:16 +0200 From: Igor Mammedov Message-ID: <20140926154216.1058f617@nial.usersys.redhat.com> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII 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 Cc: peter.maydell@linaro.org, agraf@suse.de, qemu-devel@nongnu.org, afaerber@suse.de, pbonzini@redhat.com On Thu, 25 Sep 2014 22:19:19 -0700 Peter Crosthwaite wrote: > 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) Updating doc comment in include/qom/object.h with new behavior would be nice. > { > - gchar *path = object_get_canonical_path(value); > + gchar *path = value ? object_get_canonical_path(value) : NULL; > 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); > } >