From e49ec6d7d8d9bec773378c25abb0584d1e36eb5e Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Fri, 5 Jan 2024 13:49:44 +0000 Subject: [PATCH] gicallableinfo: Remove unnecessary arguments from invoke() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The whole point of a `GICallableInfo` struct is to contain information about how a function is callable, and that includes information about whether it’s a method and whether it throws a `GError`. The caller shouldn’t need to specify those things separately. So drop those arguments. This is an API break in libgirepository, but since it’s not been in a stable release yet, that’s fine. Signed-off-by: Philip Withnall Helps: #3155 --- girepository/gicallableinfo.c | 11 +++++------ girepository/gicallableinfo.h | 2 -- girepository/gifunctioninfo.c | 8 -------- girepository/givfuncinfo.c | 2 -- 4 files changed, 5 insertions(+), 18 deletions(-) diff --git a/girepository/gicallableinfo.c b/girepository/gicallableinfo.c index 99f5f2d56..d29641b1a 100644 --- a/girepository/gicallableinfo.c +++ b/girepository/gicallableinfo.c @@ -615,15 +615,13 @@ gi_type_info_extract_ffi_return_value (GITypeInfo *return_info, * @return_value: (out caller-allocates) (not optional) (nullable): return * location for the return value from the callable; `NULL` may be returned if * the callable returns that - * @is_method: `TRUE` if @info is a method - * @throws: `TRUE` if @info may throw a [type@GLib.Error] * @error: return location for a [type@GLib.Error], or `NULL` * * Invoke the given `GICallableInfo` by calling the given @function pointer. * * The set of arguments passed to @function will be constructed according to the - * introspected type of the `GICallableInfo`, using @in_args, @out_args, - * @is_method, @throws and @error. + * introspected type of the `GICallableInfo`, using @in_args, @out_args + * and @error. * * Returns: `TRUE` if the callable was executed successfully and didn’t throw * a [type@GLib.Error]; `FALSE` if @error is set @@ -637,8 +635,6 @@ gi_callable_info_invoke (GICallableInfo *info, const GIArgument *out_args, gsize n_out_args, GIArgument *return_value, - gboolean is_method, - gboolean throws, GError **error) { ffi_cif cif; @@ -655,10 +651,13 @@ gi_callable_info_invoke (GICallableInfo *info, gpointer error_address = &local_error; GIFFIReturnValue ffi_return_value; gpointer return_value_p; /* Will point inside the union return_value */ + gboolean is_method, throws; rinfo = gi_callable_info_get_return_type ((GICallableInfo *)info); rtype = gi_type_info_get_ffi_type (rinfo); rtag = gi_type_info_get_tag(rinfo); + is_method = gi_callable_info_is_method (info); + throws = gi_callable_info_can_throw_gerror (info); in_pos = 0; out_pos = 0; diff --git a/girepository/gicallableinfo.h b/girepository/gicallableinfo.h index 9ea0473eb..30bc000cb 100644 --- a/girepository/gicallableinfo.h +++ b/girepository/gicallableinfo.h @@ -99,8 +99,6 @@ gboolean gi_callable_info_invoke (GICallableInfo *info const GIArgument *out_args, gsize n_out_args, GIArgument *return_value, - gboolean is_method, - gboolean throws, GError **error); GI_AVAILABLE_IN_ALL diff --git a/girepository/gifunctioninfo.c b/girepository/gifunctioninfo.c index 1ad43d02d..1d782a901 100644 --- a/girepository/gifunctioninfo.c +++ b/girepository/gifunctioninfo.c @@ -274,8 +274,6 @@ gi_function_info_invoke (GIFunctionInfo *info, { const gchar *symbol; gpointer func; - gboolean is_method; - gboolean throws; symbol = gi_function_info_get_symbol (info); @@ -290,10 +288,6 @@ gi_function_info_invoke (GIFunctionInfo *info, return FALSE; } - is_method = (gi_function_info_get_flags (info) & GI_FUNCTION_IS_METHOD) != 0 - && (gi_function_info_get_flags (info) & GI_FUNCTION_IS_CONSTRUCTOR) == 0; - throws = gi_function_info_get_flags (info) & GI_FUNCTION_THROWS; - return gi_callable_info_invoke ((GICallableInfo*) info, func, in_args, @@ -301,8 +295,6 @@ gi_function_info_invoke (GIFunctionInfo *info, out_args, n_out_args, return_value, - is_method, - throws, error); } diff --git a/girepository/givfuncinfo.c b/girepository/givfuncinfo.c index 781e370b6..cbf23fa1d 100644 --- a/girepository/givfuncinfo.c +++ b/girepository/givfuncinfo.c @@ -370,8 +370,6 @@ gi_vfunc_info_invoke (GIVFuncInfo *info, out_args, n_out_args, return_value, - TRUE, - FALSE, error); }