[gjs] function: Use new convenience functions for is_method/can_throw_gerror



commit 292710b387ede1373c8c392c96316426d5605466
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Mon Apr 9 15:47:10 2012 -0300

    function: Use new convenience functions for is_method/can_throw_gerror
    
    https://bugzilla.gnome.org/show_bug.cgi?id=682305

 configure.ac  |    4 ++--
 gi/function.c |   29 ++---------------------------
 2 files changed, 4 insertions(+), 29 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index fe5cd4f..e14ac44 100644
--- a/configure.ac
+++ b/configure.ac
@@ -118,10 +118,10 @@ else
 fi
 CFLAGS="$save_CFLAGS"
 
-GOBJECT_INTROSPECTION_REQUIRE([1.33.2])
+GOBJECT_INTROSPECTION_REQUIRE([1.33.10])
 
 common_packages="gmodule-2.0 gthread-2.0 gio-2.0 >= glib_required_version mozjs185"
-gjs_packages="gobject-introspection-1.0 >= 0.10.1 $common_packages"
+gjs_packages="gobject-introspection-1.0 $common_packages"
 gjs_cairo_gobject_packages="cairo-gobject $common_packages"
 gjs_cairo_packages="cairo $common_packages"
 gjs_dbus_packages="dbus-glib-1 $common_packages"
diff --git a/gi/function.c b/gi/function.c
index a1fe2b2..70e50e2 100644
--- a/gi/function.c
+++ b/gi/function.c
@@ -599,7 +599,6 @@ gjs_invoke_c_function(JSContext      *context,
     gboolean is_method;
     GITypeInfo return_info;
     GITypeTag return_tag;
-    GIInfoType info_type;
     jsval *return_values = NULL;
     guint8 next_rval = 0; /* index into return_values */
     GSList *iter;
@@ -617,32 +616,8 @@ gjs_invoke_c_function(JSContext      *context,
         completed_trampolines = NULL;
     }
 
-    info_type = g_base_info_get_type((GIBaseInfo *)function->info);
-
-    switch (info_type) {
-    case GI_INFO_TYPE_FUNCTION:
-        {
-            GIFunctionInfoFlags flags;
-            flags = g_function_info_get_flags((GIFunctionInfo *)function->info);
-            is_method = (flags & GI_FUNCTION_IS_METHOD) != 0;
-            can_throw_gerror = (flags & GI_FUNCTION_THROWS) != 0;
-        }
-        break;
-    case GI_INFO_TYPE_VFUNC:
-        {
-            GIVFuncInfoFlags flags;
-            flags = g_vfunc_info_get_flags ((GIVFuncInfo *)function->info);
-            can_throw_gerror = (flags & GI_VFUNC_THROWS) != 0;
-        }
-        is_method = TRUE;
-      break;
-    case GI_INFO_TYPE_CALLBACK:
-        is_method = TRUE;
-        can_throw_gerror = FALSE;
-        break;
-    default:
-        g_assert_not_reached();
-    }
+    is_method = g_callable_info_is_method(function->info);
+    can_throw_gerror = g_callable_info_can_throw_gerror(function->info);
 
     c_argc = function->invoker.cif.nargs;
     gi_argc = g_callable_info_get_n_args( (GICallableInfo*) function->info);



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