[libvirt] [PATCH] remove bogus casts of arg to g_object_ref

Daniel P. Berrange berrange at redhat.com
Wed Jan 17 14:43:17 UTC 2018


Latest version of glib uses typeof() magic to cast the
return value of g_object_ref to match its argument,
instead of returning a 'void *'. A few places in the
code were casting the arg to G_OBJECT() which was then
incompatible with the variable we assigned the result
to. The parameter casts were always redundant so just
remove them.

Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
---
 libvirt-gconfig/libvirt-gconfig-object.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libvirt-gconfig/libvirt-gconfig-object.c b/libvirt-gconfig/libvirt-gconfig-object.c
index 851e35c..ca2c6e6 100644
--- a/libvirt-gconfig/libvirt-gconfig-object.c
+++ b/libvirt-gconfig/libvirt-gconfig-object.c
@@ -572,7 +572,7 @@ gvir_config_object_set_node_content(GVirConfigObject *object,
         node = gvir_config_object_replace_child(object, node_name);
         g_return_if_fail(node != NULL);
     } else {
-        node = g_object_ref(G_OBJECT(object));
+        node = g_object_ref(object);
     }
     encoded_data = xmlEncodeEntitiesReentrant(node->priv->node->doc,
                                               (xmlChar *)value);
@@ -896,7 +896,7 @@ gvir_config_object_attach(GVirConfigObject *parent, GVirConfigObject *child, gbo
         child->priv->doc = NULL;
     }
     if (parent->priv->doc != NULL) {
-        child->priv->doc = g_object_ref(G_OBJECT(parent->priv->doc));
+        child->priv->doc = g_object_ref(parent->priv->doc);
     }
 }
 
-- 
2.14.3




More information about the libvir-list mailing list