Received: from eggs.gnu.org ([2001:4830:134:3::10]:45116) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XfAL8-0003Iu-5B for qemu-devel@nongnu.org; Fri, 17 Oct 2014 12:25:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XfAL0-0004Zo-6v for qemu-devel@nongnu.org; Fri, 17 Oct 2014 12:25:18 -0400 Received: from mail-wi0-x235.google.com ([2a00:1450:400c:c05::235]:57284) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XfAL0-0004Zi-0S for qemu-devel@nongnu.org; Fri, 17 Oct 2014 12:25:10 -0400 Received: by mail-wi0-f181.google.com with SMTP id hi2so1713224wib.2 for ; Fri, 17 Oct 2014 09:25:09 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Fri, 17 Oct 2014 18:24:46 +0200 Message-Id: <1413563095-27301-5-git-send-email-pbonzini@redhat.com> In-Reply-To: <1413563095-27301-1-git-send-email-pbonzini@redhat.com> References: <1413563095-27301-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH qom v4 04/13] qom: Allow clearing of a Link property List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Crosthwaite , afaerber@suse.de, agraf@suse.de From: Peter Crosthwaite By passing in "" to object_property_set_link. The lead user of this is the QDEV GPIO framework which will implement GPIO disconnects via an "unlink". GPIO disconnection is used by qtest's irq_intercept_out command. Reviewed-by: Alexander Graf Signed-off-by: Peter Crosthwaite Signed-off-by: Paolo Bonzini --- v3->v4: pass an empty string, not NULL --- qom/object.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/qom/object.c b/qom/object.c index da0919a..7d617da 100644 --- a/qom/object.c +++ b/qom/object.c @@ -870,9 +870,13 @@ 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); - object_property_set_str(obj, path, name, errp); - g_free(path); + if (value) { + gchar *path = object_get_canonical_path(value); + object_property_set_str(obj, path, name, errp); + g_free(path); + } else { + object_property_set_str(obj, "", name, errp); + } } Object *object_property_get_link(Object *obj, const char *name, -- 2.1.0