[pygobject/gsoc2009: 90/160] Refactor _wrap_g_function_info_is_(method|constructor)



commit cf797f7b3f6f210c186a4168fba43d1d101f31f4
Author: Simon van der Linden <svdlinden src gnome org>
Date:   Mon Aug 3 14:05:40 2009 +0200

    Refactor _wrap_g_function_info_is_(method|constructor)

 gi/pygiinfo.c |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/gi/pygiinfo.c b/gi/pygiinfo.c
index 7354fae..0e05d89 100644
--- a/gi/pygiinfo.c
+++ b/gi/pygiinfo.c
@@ -331,15 +331,25 @@ PYGIINFO_DEFINE_TYPE("FunctionInfo", GIFunctionInfo, PyGICallableInfo_Type);
 static PyObject *
 _wrap_g_function_info_is_constructor(PyGIBaseInfo *self)
 {
-    return PyInt_FromLong(g_function_info_get_flags((GIFunctionInfo*)self->info) &
-                          GI_FUNCTION_IS_CONSTRUCTOR);
+    GIFunctionInfoFlags flags;
+    gboolean is_constructor;
+
+    flags = g_function_info_get_flags((GIFunctionInfo*)self->info);
+    is_constructor = flags & GI_FUNCTION_IS_CONSTRUCTOR;
+
+    return PyBool_FromLong(is_constructor);
 }
 
 static PyObject *
 _wrap_g_function_info_is_method(PyGIBaseInfo *self)
 {
-    return PyInt_FromLong(g_function_info_get_flags((GIFunctionInfo*)self->info) &
-                          GI_FUNCTION_IS_METHOD);
+    GIFunctionInfoFlags flags;
+    gboolean is_method;
+
+    flags = g_function_info_get_flags((GIFunctionInfo*)self->info);
+    is_method = flags & GI_FUNCTION_IS_METHOD;
+
+    return PyBool_FromLong(is_method);
 }
 
 static



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