qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH qom v4 04/13] qom: Allow clearing of a Link property


From: Paolo Bonzini
Subject: [Qemu-devel] [PATCH qom v4 04/13] qom: Allow clearing of a Link property
Date: Fri, 17 Oct 2014 18:24:46 +0200

From: Peter Crosthwaite <address@hidden>

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 <address@hidden>
Signed-off-by: Peter Crosthwaite <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
        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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]