[pygobject/gsoc2009: 95/160] Refactor _wrap_g_object_info_get_parent



commit e91043de7a3ed7a3fd70f39019e4689f4999f3f9
Author: Simon van der Linden <svdlinden src gnome org>
Date:   Mon Aug 3 15:31:33 2009 +0200

    Refactor _wrap_g_object_info_get_parent

 gi/pygiinfo.c |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/gi/pygiinfo.c b/gi/pygiinfo.c
index 9cac53b..5a8df13 100644
--- a/gi/pygiinfo.c
+++ b/gi/pygiinfo.c
@@ -1200,17 +1200,20 @@ PYGIINFO_DEFINE_TYPE("ObjectInfo", GIObjectInfo, PyGIRegisteredTypeInfo_Type);
 static PyObject *
 _wrap_g_object_info_get_parent(PyGIBaseInfo *self)
 {
-    GIObjectInfo *parent_info;
+    GIBaseInfo *info;
+    PyObject *py_info;
 
-    g_base_info_ref(self->info);
-    parent_info = g_object_info_get_parent((GIObjectInfo*)self->info);
-    g_base_info_unref(self->info);
+    info = (GIBaseInfo *)g_object_info_get_parent((GIObjectInfo*)self->info);
 
-    if (parent_info)
-        return pyg_info_new(parent_info);
+    if (info == NULL) {
+        Py_RETURN_NONE;
+    }
 
-    Py_INCREF(Py_None);
-    return Py_None;
+    py_info = pyg_info_new(info);
+
+    g_base_info_unref(info);
+
+    return py_info;
 }
 
 static PyObject *



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