gicallableinfo: Remove unnecessary arguments from invoke()

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 <pwithnall@gnome.org>

Helps: #3155
This commit is contained in:
Philip Withnall 2024-01-05 13:49:44 +00:00
parent 8e5ff50dd4
commit e49ec6d7d8
4 changed files with 5 additions and 18 deletions

View File

@ -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 didnt 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;

View File

@ -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

View File

@ -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);
}

View File

@ -370,8 +370,6 @@ gi_vfunc_info_invoke (GIVFuncInfo *info,
out_args,
n_out_args,
return_value,
TRUE,
FALSE,
error);
}