girrepository: Use void* instead of gpointer

This commit is contained in:
Marco Trevisan (Treviño) 2024-01-15 20:16:00 +01:00
parent 44e4555765
commit eda4bfcf95
24 changed files with 94 additions and 96 deletions

View File

@ -64,7 +64,7 @@ value_base_info_copy_value (const GValue *src,
dst->data[0].v_pointer = NULL;
}
static gpointer
static void *
value_base_info_peek_pointer (const GValue *value)
{
return value->data[0].v_pointer;

View File

@ -44,10 +44,8 @@ G_BEGIN_DECLS
*/
typedef struct {
/*< private >*/
gpointer data;
gpointer data2;
gpointer data3;
gpointer data4;
void *data;
void *_dummy[4];
} GIAttributeIter;
#define GI_TYPE_BASE_INFO (gi_base_info_get_type ())

View File

@ -556,12 +556,12 @@ gi_type_tag_extract_ffi_return_value (GITypeTag return_tag,
arg->v_int32 = (gint32) ffi_value->v_long;
break;
default:
arg->v_pointer = (gpointer) ffi_value->v_pointer;
arg->v_pointer = (void *) ffi_value->v_pointer;
break;
}
break;
default:
arg->v_pointer = (gpointer) ffi_value->v_pointer;
arg->v_pointer = (void *) ffi_value->v_pointer;
break;
}
}
@ -629,7 +629,7 @@ gi_type_info_extract_ffi_return_value (GITypeInfo *return_info,
*/
gboolean
gi_callable_info_invoke (GICallableInfo *info,
gpointer function,
void *function,
const GIArgument *in_args,
gsize n_in_args,
GIArgument *out_args,
@ -645,12 +645,12 @@ gi_callable_info_invoke (GICallableInfo *info,
GITypeTag rtag;
GIArgInfo *ainfo;
gsize n_args, n_invoke_args, in_pos, out_pos, i;
gpointer *args;
void **args;
gboolean success = FALSE;
GError *local_error = NULL;
gpointer error_address = &local_error;
void *error_address = &local_error;
GIFFIReturnValue ffi_return_value;
gpointer return_value_p; /* Will point inside the union return_value */
void *return_value_p; /* Will point inside the union return_value */
gboolean is_method, throws;
rinfo = gi_callable_info_get_return_type ((GICallableInfo *)info);
@ -684,12 +684,12 @@ gi_callable_info_invoke (GICallableInfo *info,
n_invoke_args ++;
atypes = g_alloca (sizeof (ffi_type*) * n_invoke_args);
args = g_alloca (sizeof (gpointer) * n_invoke_args);
args = g_alloca (sizeof (void *) * n_invoke_args);
if (is_method)
{
atypes[0] = &ffi_type_pointer;
args[0] = (gpointer) &in_args[0];
args[0] = (void *) &in_args[0];
}
for (i = 0; i < n_args; i++)
{
@ -712,7 +712,7 @@ gi_callable_info_invoke (GICallableInfo *info,
goto out;
}
args[i+offset] = (gpointer)&in_args[in_pos];
args[i+offset] = (void *)&in_args[in_pos];
in_pos++;
break;
@ -729,7 +729,7 @@ gi_callable_info_invoke (GICallableInfo *info,
goto out;
}
args[i+offset] = (gpointer)&out_args[out_pos];
args[i+offset] = (void *)&out_args[out_pos];
out_pos++;
break;
case GI_DIRECTION_INOUT:
@ -754,7 +754,7 @@ gi_callable_info_invoke (GICallableInfo *info,
goto out;
}
args[i+offset] = (gpointer)&in_args[in_pos];
args[i+offset] = (void *)&in_args[in_pos];
in_pos++;
out_pos++;
break;

View File

@ -93,7 +93,7 @@ void gi_callable_info_load_arg (GICallableInfo *info,
GI_AVAILABLE_IN_ALL
gboolean gi_callable_info_invoke (GICallableInfo *info,
gpointer function,
void *function,
const GIArgument *in_args,
gsize n_in_args,
GIArgument *out_args,

View File

@ -187,7 +187,7 @@ gi_field_info_get_type_info (GIFieldInfo *info)
*/
gboolean
gi_field_info_get_field (GIFieldInfo *field_info,
gpointer mem,
void *mem,
GIArgument *value)
{
int offset;
@ -205,7 +205,7 @@ gi_field_info_get_field (GIFieldInfo *field_info,
if (gi_type_info_is_pointer (type_info))
{
value->v_pointer = G_STRUCT_MEMBER (gpointer, mem, offset);
value->v_pointer = G_STRUCT_MEMBER (void *, mem, offset);
result = TRUE;
}
else
@ -383,7 +383,7 @@ gi_field_info_get_field (GIFieldInfo *field_info,
*/
gboolean
gi_field_info_set_field (GIFieldInfo *field_info,
gpointer mem,
void *mem,
const GIArgument *value)
{
int offset;
@ -548,7 +548,7 @@ gi_field_info_set_field (GIFieldInfo *field_info,
{
case GI_INFO_TYPE_OBJECT:
case GI_INFO_TYPE_INTERFACE:
G_STRUCT_MEMBER (gpointer, mem, offset) = (gpointer)value->v_pointer;
G_STRUCT_MEMBER (void *, mem, offset) = (void *)value->v_pointer;
result = TRUE;
break;
default:

View File

@ -58,12 +58,12 @@ GITypeInfo * gi_field_info_get_type_info (GIFieldInfo *info);
GI_AVAILABLE_IN_ALL
gboolean gi_field_info_get_field (GIFieldInfo *field_info,
gpointer mem,
void *mem,
GIArgument *value);
GI_AVAILABLE_IN_ALL
gboolean gi_field_info_set_field (GIFieldInfo *field_info,
gpointer mem,
void *mem,
const GIArgument *value);
G_END_DECLS

View File

@ -273,7 +273,7 @@ gi_function_info_invoke (GIFunctionInfo *info,
GError **error)
{
const gchar *symbol;
gpointer func;
void *func;
symbol = gi_function_info_get_symbol (info);

View File

@ -44,7 +44,7 @@
* Since: 2.80
*/
static ffi_type *
value_to_ffi_type (const GValue *gvalue, gpointer *value)
value_to_ffi_type (const GValue *gvalue, void **value)
{
ffi_type *rettype = NULL;
GType type = g_type_fundamental (G_VALUE_TYPE (gvalue));
@ -56,12 +56,12 @@ value_to_ffi_type (const GValue *gvalue, gpointer *value)
case G_TYPE_CHAR:
case G_TYPE_INT:
rettype = &ffi_type_sint;
*value = (gpointer)&(gvalue->data[0].v_int);
*value = (void *) &(gvalue->data[0].v_int);
break;
case G_TYPE_UCHAR:
case G_TYPE_UINT:
rettype = &ffi_type_uint;
*value = (gpointer)&(gvalue->data[0].v_uint);
*value = (void *) &(gvalue->data[0].v_uint);
break;
case G_TYPE_STRING:
case G_TYPE_OBJECT:
@ -69,31 +69,31 @@ value_to_ffi_type (const GValue *gvalue, gpointer *value)
case G_TYPE_POINTER:
case G_TYPE_PARAM:
rettype = &ffi_type_pointer;
*value = (gpointer)&(gvalue->data[0].v_pointer);
*value = (void *) &(gvalue->data[0].v_pointer);
break;
case G_TYPE_FLOAT:
rettype = &ffi_type_float;
*value = (gpointer)&(gvalue->data[0].v_float);
*value = (void *) &(gvalue->data[0].v_float);
break;
case G_TYPE_DOUBLE:
rettype = &ffi_type_double;
*value = (gpointer)&(gvalue->data[0].v_double);
*value = (void *) &(gvalue->data[0].v_double);
break;
case G_TYPE_LONG:
rettype = &ffi_type_slong;
*value = (gpointer)&(gvalue->data[0].v_long);
*value = (void *) &(gvalue->data[0].v_long);
break;
case G_TYPE_ULONG:
rettype = &ffi_type_ulong;
*value = (gpointer)&(gvalue->data[0].v_ulong);
*value = (void *) &(gvalue->data[0].v_ulong);
break;
case G_TYPE_INT64:
rettype = &ffi_type_sint64;
*value = (gpointer)&(gvalue->data[0].v_int64);
*value = (void *) &(gvalue->data[0].v_int64);
break;
case G_TYPE_UINT64:
rettype = &ffi_type_uint64;
*value = (gpointer)&(gvalue->data[0].v_uint64);
*value = (void *) &(gvalue->data[0].v_uint64);
break;
default:
rettype = &ffi_type_pointer;
@ -122,13 +122,13 @@ value_to_ffi_type (const GValue *gvalue, gpointer *value)
static ffi_type *
g_value_to_ffi_return_type (const GValue *gvalue,
const GIArgument *ffi_value,
gpointer *value)
void **value)
{
ffi_type *rettype = NULL;
GType type = g_type_fundamental (G_VALUE_TYPE (gvalue));
g_assert (type != G_TYPE_INVALID);
*value = (gpointer)&(ffi_value->v_long);
*value = (void *) &(ffi_value->v_long);
switch (type) {
case G_TYPE_CHAR:
@ -153,11 +153,11 @@ g_value_to_ffi_return_type (const GValue *gvalue,
break;
case G_TYPE_FLOAT:
rettype = &ffi_type_float;
*value = (gpointer)&(ffi_value->v_float);
*value = (void *) &(ffi_value->v_float);
break;
case G_TYPE_DOUBLE:
rettype = &ffi_type_double;
*value = (gpointer)&(ffi_value->v_double);
*value = (void *) &(ffi_value->v_double);
break;
case G_TYPE_LONG:
rettype = &ffi_type_slong;
@ -167,11 +167,11 @@ g_value_to_ffi_return_type (const GValue *gvalue,
break;
case G_TYPE_INT64:
rettype = &ffi_type_sint64;
*value = (gpointer)&(ffi_value->v_int64);
*value = (void *) &(ffi_value->v_int64);
break;
case G_TYPE_UINT64:
rettype = &ffi_type_uint64;
*value = (gpointer)&(ffi_value->v_uint64);
*value = (void *) &(ffi_value->v_uint64);
break;
default:
rettype = &ffi_type_pointer;
@ -272,8 +272,8 @@ gi_cclosure_marshal_generic (GClosure *closure,
GValue *return_gvalue,
guint n_param_values,
const GValue *param_values,
gpointer invocation_hint,
gpointer marshal_data)
void *invocation_hint,
void *marshal_data)
{
GIArgument return_ffi_value = { 0, };
ffi_type *rtype;
@ -298,7 +298,7 @@ gi_cclosure_marshal_generic (GClosure *closure,
n_args = n_param_values + 1;
atypes = g_alloca (sizeof (ffi_type *) * n_args);
args = g_alloca (sizeof (gpointer) * n_args);
args = g_alloca (sizeof (void *) * n_args);
if (n_param_values > 0)
{

View File

@ -925,7 +925,7 @@ _get_func(GIObjectInfo *info,
const char* symbol;
GSList *parents = NULL, *l;
GIObjectInfo *parent_info;
gpointer func = NULL;
void *func = NULL;
parent_info = (GIObjectInfo *) gi_base_info_ref ((GIBaseInfo *) info);
while (parent_info != NULL)

View File

@ -1083,7 +1083,7 @@ gi_repository_get_object_gtype_interfaces (GIRepository *repository,
repository = get_repository (repository);
cache = g_hash_table_lookup (repository->priv->interfaces_for_gtype,
(gpointer) gtype);
(void *) gtype);
if (cache == NULL)
{
GType *interfaces;

View File

@ -251,7 +251,7 @@ void gi_cclosure_marshal_generic (GClosure *closure,
GValue *return_gvalue,
guint n_param_values,
const GValue *param_values,
gpointer invocation_hint,
gpointer marshal_data);
void *invocation_hint,
void *marshal_data);
G_END_DECLS

View File

@ -276,7 +276,7 @@ gi_function_info_prep_invoker (GIFunctionInfo *info,
GError **error)
{
const char *symbol;
gpointer addr;
void *addr;
g_return_val_if_fail (info != NULL, FALSE);
g_return_val_if_fail (invoker != NULL, FALSE);
@ -316,7 +316,7 @@ gi_function_info_prep_invoker (GIFunctionInfo *info,
* Since: 2.80
*/
gboolean
gi_function_invoker_new_for_address (gpointer addr,
gi_function_invoker_new_for_address (void *addr,
GICallableInfo *info,
GIFunctionInvoker *invoker,
GError **error)
@ -355,8 +355,8 @@ gi_function_invoker_destroy (GIFunctionInvoker *invoker)
typedef struct {
ffi_closure ffi_closure;
gpointer writable_self;
gpointer native_address;
void *writable_self;
void *native_address;
} GIClosureWrapper;
/**
@ -377,9 +377,9 @@ ffi_closure *
gi_callable_info_create_closure (GICallableInfo *callable_info,
ffi_cif *cif,
GIFFIClosureCallback callback,
gpointer user_data)
void *user_data)
{
gpointer exec_ptr;
void *exec_ptr;
size_t n_args;
ffi_type **atypes;
GIClosureWrapper *closure;
@ -432,7 +432,7 @@ gi_callable_info_create_closure (GICallableInfo *callable_info,
* Returns: (transfer none): native address
* Since: 2.80
*/
gpointer *
void **
gi_callable_info_get_closure_native_address (GICallableInfo *callable_info,
ffi_closure *closure)
{

View File

@ -65,9 +65,9 @@ typedef void (*GIFFIClosureCallback) (ffi_cif *cif,
*/
typedef struct {
ffi_cif cif;
gpointer native_address;
void *native_address;
/*< private >*/
gpointer padding[3];
void *padding[3];
} GIFunctionInvoker;
/**
@ -102,7 +102,7 @@ gboolean gi_function_info_prep_invoker (GIFunctionInfo *info,
GError **error);
GI_AVAILABLE_IN_ALL
gboolean gi_function_invoker_new_for_address (gpointer addr,
gboolean gi_function_invoker_new_for_address (void *addr,
GICallableInfo *info,
GIFunctionInvoker *invoker,
GError **error);
@ -115,10 +115,10 @@ GI_AVAILABLE_IN_ALL
ffi_closure * gi_callable_info_create_closure (GICallableInfo *callable_info,
ffi_cif *cif,
GIFFIClosureCallback callback,
gpointer user_data);
void *user_data);
GI_AVAILABLE_IN_ALL
gpointer * gi_callable_info_get_closure_native_address (GICallableInfo *callable_info,
void ** gi_callable_info_get_closure_native_address (GICallableInfo *callable_info,
ffi_closure *closure);
GI_AVAILABLE_IN_ALL

View File

@ -235,9 +235,9 @@ write_attributes (GIIrModule *module,
return wdata.count;
}
static gint
node_cmp_offset_func (gconstpointer a,
gconstpointer b)
static int
node_cmp_offset_func (const void *a,
const void *b)
{
const GIIrNode *na = a;
const GIIrNode *nb = b;

View File

@ -2417,8 +2417,8 @@ gi_ir_write_string (const gchar *str,
guchar *data,
guint32 *offset)
{
gpointer value;
guint32 start;
void *value;
string_count += 1;
string_size += strlen (str);
@ -2431,7 +2431,7 @@ gi_ir_write_string (const gchar *str,
unique_string_count += 1;
unique_string_size += strlen (str);
g_hash_table_insert (strings, (gpointer)str, GUINT_TO_POINTER (*offset));
g_hash_table_insert (strings, (void *)str, GUINT_TO_POINTER (*offset));
start = *offset;
*offset = ALIGN_VALUE (start + strlen (str) + 1, 4);

View File

@ -136,20 +136,20 @@ static void start_element_handler (GMarkupParseContext *context,
const gchar *element_name,
const gchar **attribute_names,
const gchar **attribute_values,
gpointer user_data,
void *user_data,
GError **error);
static void end_element_handler (GMarkupParseContext *context,
const gchar *element_name,
gpointer user_data,
void *user_data,
GError **error);
static void text_handler (GMarkupParseContext *context,
const gchar *text,
gsize text_len,
gpointer user_data,
void *user_data,
GError **error);
static void cleanup (GMarkupParseContext *context,
GError *error,
gpointer user_data);
void *user_data);
static void state_switch (ParseContext *ctx, ParseState newstate);
@ -222,7 +222,7 @@ firstpass_start_element_handler (GMarkupParseContext *context,
const gchar *element_name,
const gchar **attribute_names,
const gchar **attribute_values,
gpointer user_data,
void *user_data,
GError **error)
{
ParseContext *ctx = user_data;
@ -267,7 +267,7 @@ firstpass_start_element_handler (GMarkupParseContext *context,
static void
firstpass_end_element_handler (GMarkupParseContext *context,
const gchar *element_name,
gpointer user_data,
void *user_data,
GError **error)
{
ParseContext *ctx = user_data;
@ -678,8 +678,8 @@ parse_type_internal (GIIrModule *module,
static const char *
resolve_aliases (ParseContext *ctx, const gchar *type)
{
gpointer orig;
gpointer value;
void *orig;
void *value;
GSList *seen_values = NULL;
const gchar *lookup;
gchar *prefixed;
@ -2885,7 +2885,7 @@ start_element_handler (GMarkupParseContext *context,
const gchar *element_name,
const gchar **attribute_names,
const gchar **attribute_values,
gpointer user_data,
void *user_data,
GError **error)
{
ParseContext *ctx = user_data;
@ -3346,7 +3346,7 @@ require_end_element (GMarkupParseContext *context,
static void
end_element_handler (GMarkupParseContext *context,
const gchar *element_name,
gpointer user_data,
void *user_data,
GError **error)
{
ParseContext *ctx = user_data;
@ -3648,7 +3648,7 @@ static void
text_handler (GMarkupParseContext *context,
const gchar *text,
gsize text_len,
gpointer user_data,
void *user_data,
GError **error)
{
/* FIXME warn about non-whitespace text */
@ -3657,7 +3657,7 @@ text_handler (GMarkupParseContext *context,
static void
cleanup (GMarkupParseContext *context,
GError *error,
gpointer user_data)
void *user_data)
{
ParseContext *ctx = user_data;
GList *m;

View File

@ -426,7 +426,7 @@ gi_type_info_get_storage_type (GITypeInfo *info)
*/
void
gi_type_tag_argument_from_hash_pointer (GITypeTag storage_type,
gpointer hash_pointer,
void *hash_pointer,
GIArgument *arg)
{
switch (storage_type)
@ -503,7 +503,7 @@ gi_type_tag_argument_from_hash_pointer (GITypeTag storage_type,
*/
void
gi_type_info_argument_from_hash_pointer (GITypeInfo *info,
gpointer hash_pointer,
void *hash_pointer,
GIArgument *arg)
{
GITypeTag storage_type = gi_type_info_get_storage_type (info);
@ -537,7 +537,7 @@ gi_type_info_argument_from_hash_pointer (GITypeInfo *info,
* for example
* Since: 2.80
*/
gpointer
void *
gi_type_tag_hash_pointer_from_argument (GITypeTag storage_type,
GIArgument *arg)
{
@ -605,7 +605,7 @@ gi_type_tag_hash_pointer_from_argument (GITypeTag storage_type,
* for example
* Since: 2.80
*/
gpointer
void *
gi_type_info_hash_pointer_from_argument (GITypeInfo *info,
GIArgument *arg)
{

View File

@ -112,20 +112,20 @@ GITypeTag gi_type_info_get_storage_type (GITypeInfo *info);
GI_AVAILABLE_IN_ALL
void gi_type_info_argument_from_hash_pointer (GITypeInfo *info,
gpointer hash_pointer,
void *hash_pointer,
GIArgument *arg);
GI_AVAILABLE_IN_ALL
gpointer gi_type_info_hash_pointer_from_argument (GITypeInfo *info,
void * gi_type_info_hash_pointer_from_argument (GITypeInfo *info,
GIArgument *arg);
GI_AVAILABLE_IN_ALL
void gi_type_tag_argument_from_hash_pointer (GITypeTag storage_type,
gpointer hash_pointer,
void *hash_pointer,
GIArgument *arg);
GI_AVAILABLE_IN_ALL
gpointer gi_type_tag_hash_pointer_from_argument (GITypeTag storage_type,
void * gi_type_tag_hash_pointer_from_argument (GITypeTag storage_type,
GIArgument *arg);
G_END_DECLS

View File

@ -2541,7 +2541,7 @@ gi_typelib_get_namespace (GITypelib *typelib)
* Since: 2.80
*/
gboolean
gi_typelib_symbol (GITypelib *typelib, const char *symbol_name, gpointer *symbol)
gi_typelib_symbol (GITypelib *typelib, const char *symbol_name, void **symbol)
{
GList *l;

View File

@ -55,8 +55,8 @@ void gi_typelib_free (GITypelib *typelib);
GI_AVAILABLE_IN_ALL
gboolean gi_typelib_symbol (GITypelib *typelib,
const gchar *symbol_name,
gpointer *symbol);
const gchar *symbol_name,
void **symbol);
GI_AVAILABLE_IN_ALL
const gchar * gi_typelib_get_namespace (GITypelib *typelib);

View File

@ -133,7 +133,7 @@ union _GIArgument
gssize v_ssize;
gsize v_size;
gchar * v_string;
gpointer v_pointer;
void *v_pointer;
};
/**

View File

@ -217,7 +217,7 @@ gi_vfunc_info_get_invoker (GIVFuncInfo *info)
* Returns: address to a function
* Since: 2.80
*/
gpointer
void *
gi_vfunc_info_get_address (GIVFuncInfo *vfunc_info,
GType implementor_gtype,
GError **error)
@ -228,8 +228,8 @@ gi_vfunc_info_get_address (GIVFuncInfo *vfunc_info,
GIStructInfo *struct_info;
GIFieldInfo *field_info = NULL;
int length, i, offset;
gpointer implementor_class, implementor_vtable;
gpointer func = NULL;
void *implementor_class, *implementor_vtable;
void *func = NULL;
g_return_val_if_fail (vfunc_info != NULL, NULL);
g_return_val_if_fail (GI_IS_VFUNC_INFO (vfunc_info), NULL);
@ -288,7 +288,7 @@ gi_vfunc_info_get_address (GIVFuncInfo *vfunc_info,
}
offset = gi_field_info_get_offset (field_info);
func = *(gpointer*) G_STRUCT_MEMBER_P (implementor_vtable, offset);
func = *(void**) G_STRUCT_MEMBER_P (implementor_vtable, offset);
g_type_class_unref (implementor_class);
gi_base_info_unref ((GIBaseInfo *) field_info);
@ -347,7 +347,7 @@ gi_vfunc_info_invoke (GIVFuncInfo *info,
GIArgument *return_value,
GError **error)
{
gpointer func;
void *func;
GError *local_error = NULL;
g_return_val_if_fail (info != NULL, FALSE);

View File

@ -56,7 +56,7 @@ GI_AVAILABLE_IN_ALL
GIFunctionInfo * gi_vfunc_info_get_invoker (GIVFuncInfo *info);
GI_AVAILABLE_IN_ALL
gpointer gi_vfunc_info_get_address (GIVFuncInfo *info,
void * gi_vfunc_info_get_address (GIVFuncInfo *info,
GType implementor_gtype,
GError **error);

View File

@ -86,7 +86,7 @@ gi_typelib_hash_builder_prepare (GITypelibHashBuilder *builder)
{
char **strs;
GHashTableIter hashiter;
gpointer key, value;
void *key, *value;
cmph_io_adapter_t *io;
cmph_config_t *config;
guint32 num_elts;
@ -152,7 +152,7 @@ gi_typelib_hash_builder_pack (GITypelibHashBuilder *builder, guint8* mem, guint3
{
guint16 *table;
GHashTableIter hashiter;
gpointer key, value;
void *key, *value;
#ifndef G_DISABLE_ASSERT
guint32 num_elts;
#endif