gibaseinfo: Rename gi_info_new() to gi_base_info_new()

It’s actually a factory method rather than a constructor, since
`GIBaseInfo` is abstract, but despite that, changing the name so it sits
inside the `GIBaseInfo` class makes sense. There is no `GIInfo` type.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3155
This commit is contained in:
Philip Withnall 2024-02-08 10:34:40 +00:00
parent 78698af73f
commit beb59595b7
13 changed files with 59 additions and 58 deletions

View File

@ -50,6 +50,7 @@ your code if integer type warnings are enabled.
| `g_arg_info_load_type` | [method@GIRepository.ArgInfo.load_type_info] | | `g_arg_info_load_type` | [method@GIRepository.ArgInfo.load_type_info] |
| - | [method@GIRepository.BaseInfo.ref] and [method@GIRepository.BaseInfo.unref] | | - | [method@GIRepository.BaseInfo.ref] and [method@GIRepository.BaseInfo.unref] |
| `g_base_info_get_type` | [method@GIRepository.BaseInfo.get_info_type] | | `g_base_info_get_type` | [method@GIRepository.BaseInfo.get_info_type] |
| `g_info_new` | [ctor@GIRepository.BaseInfo.new] |
| `g_callable_info_invoke` arguments | `is_method` and `throws` dropped in [method@GIRepository.CallableInfo.invoke] | | `g_callable_info_invoke` arguments | `is_method` and `throws` dropped in [method@GIRepository.CallableInfo.invoke] |
| `g_constant_info_get_type` | [method@GIRepository.ConstantInfo.get_type_info] | | `g_constant_info_get_type` | [method@GIRepository.ConstantInfo.get_type_info] |
| `g_field_info_get_type` | [method@GIRepository.FieldInfo.get_type_info] | | `g_field_info_get_type` | [method@GIRepository.FieldInfo.get_type_info] |

View File

@ -366,7 +366,7 @@ gi_info_new_full (GIInfoType type,
} }
/** /**
* gi_info_new: * gi_base_info_new:
* @type: type of the info to create * @type: type of the info to create
* @container: (nullable): info which contains this one * @container: (nullable): info which contains this one
* @typelib: typelib containing the info * @typelib: typelib containing the info
@ -380,10 +380,10 @@ gi_info_new_full (GIInfoType type,
* Since: 2.80 * Since: 2.80
*/ */
GIBaseInfo * GIBaseInfo *
gi_info_new (GIInfoType type, gi_base_info_new (GIInfoType type,
GIBaseInfo *container, GIBaseInfo *container,
GITypelib *typelib, GITypelib *typelib,
size_t offset) size_t offset)
{ {
return gi_info_new_full (type, ((GIRealInfo*)container)->repository, container, typelib, offset); return gi_info_new_full (type, ((GIRealInfo*)container)->repository, container, typelib, offset);
} }
@ -510,8 +510,8 @@ gi_type_info_new (GIBaseInfo *container,
{ {
SimpleTypeBlob *type = (SimpleTypeBlob *)&typelib->data[offset]; SimpleTypeBlob *type = (SimpleTypeBlob *)&typelib->data[offset];
return (GITypeInfo *) gi_info_new (GI_INFO_TYPE_TYPE, container, typelib, return (GITypeInfo *) gi_base_info_new (GI_INFO_TYPE_TYPE, container, typelib,
(type->flags.reserved == 0 && type->flags.reserved2 == 0) ? offset : type->offset); (type->flags.reserved == 0 && type->flags.reserved2 == 0) ? offset : type->offset);
} }
/*< private > /*< private >

View File

@ -130,7 +130,7 @@ gboolean gi_base_info_equal (GIBaseInfo *info1,
GIBaseInfo *info2); GIBaseInfo *info2);
GI_AVAILABLE_IN_ALL GI_AVAILABLE_IN_ALL
GIBaseInfo * gi_info_new (GIInfoType type, GIBaseInfo * gi_base_info_new (GIInfoType type,
GIBaseInfo *container, GIBaseInfo *container,
GITypelib *typelib, GITypelib *typelib,
size_t offset); size_t offset);

View File

@ -379,8 +379,8 @@ gi_callable_info_get_arg (GICallableInfo *info,
offset = signature_offset (info); offset = signature_offset (info);
header = (Header *)rinfo->typelib->data; header = (Header *)rinfo->typelib->data;
return (GIArgInfo *) gi_info_new (GI_INFO_TYPE_ARG, (GIBaseInfo*)info, rinfo->typelib, return (GIArgInfo *) gi_base_info_new (GI_INFO_TYPE_ARG, (GIBaseInfo*)info, rinfo->typelib,
offset + header->signature_blob_size + n * header->arg_blob_size); offset + header->signature_blob_size + n * header->arg_blob_size);
} }
/** /**

View File

@ -124,7 +124,7 @@ gi_enum_info_get_value (GIEnumInfo *info,
offset = rinfo->offset + header->enum_blob_size offset = rinfo->offset + header->enum_blob_size
+ n * header->value_blob_size; + n * header->value_blob_size;
return (GIValueInfo *) gi_info_new (GI_INFO_TYPE_VALUE, (GIBaseInfo*)info, rinfo->typelib, offset); return (GIValueInfo *) gi_base_info_new (GI_INFO_TYPE_VALUE, (GIBaseInfo*)info, rinfo->typelib, offset);
} }
/** /**
@ -181,8 +181,8 @@ gi_enum_info_get_method (GIEnumInfo *info,
+ blob->n_values * header->value_blob_size + blob->n_values * header->value_blob_size
+ n * header->function_blob_size; + n * header->function_blob_size;
return (GIFunctionInfo *) gi_info_new (GI_INFO_TYPE_FUNCTION, (GIBaseInfo*)info, return (GIFunctionInfo *) gi_base_info_new (GI_INFO_TYPE_FUNCTION, (GIBaseInfo*)info,
rinfo->typelib, offset); rinfo->typelib, offset);
} }
/** /**

View File

@ -158,9 +158,9 @@ gi_field_info_get_type_info (GIFieldInfo *info)
if (blob->has_embedded_type) if (blob->has_embedded_type)
{ {
type_info = (GIRealInfo *) gi_info_new (GI_INFO_TYPE_TYPE, type_info = (GIRealInfo *) gi_base_info_new (GI_INFO_TYPE_TYPE,
(GIBaseInfo*)info, rinfo->typelib, (GIBaseInfo*)info, rinfo->typelib,
rinfo->offset + header->field_blob_size); rinfo->offset + header->field_blob_size);
type_info->type_is_embedded = TRUE; type_info->type_is_embedded = TRUE;
} }
else else

View File

@ -64,8 +64,8 @@ gi_base_info_find_method (GIBaseInfo *base,
const char *fname = (const char *)&rinfo->typelib->data[fblob->name]; const char *fname = (const char *)&rinfo->typelib->data[fblob->name];
if (strcmp (name, fname) == 0) if (strcmp (name, fname) == 0)
return (GIFunctionInfo *) gi_info_new (GI_INFO_TYPE_FUNCTION, base, return (GIFunctionInfo *) gi_base_info_new (GI_INFO_TYPE_FUNCTION, base,
rinfo->typelib, offset); rinfo->typelib, offset);
offset += header->function_blob_size; offset += header->function_blob_size;
} }

View File

@ -152,8 +152,8 @@ gi_interface_info_get_property (GIInterfaceInfo *info,
+ (blob->n_prerequisites + (blob->n_prerequisites % 2)) * 2 + (blob->n_prerequisites + (blob->n_prerequisites % 2)) * 2
+ n * header->property_blob_size; + n * header->property_blob_size;
return (GIPropertyInfo *) gi_info_new (GI_INFO_TYPE_PROPERTY, (GIBaseInfo*)info, return (GIPropertyInfo *) gi_base_info_new (GI_INFO_TYPE_PROPERTY, (GIBaseInfo*)info,
rinfo->typelib, offset); rinfo->typelib, offset);
} }
/** /**
@ -211,8 +211,8 @@ gi_interface_info_get_method (GIInterfaceInfo *info,
+ blob->n_properties * header->property_blob_size + blob->n_properties * header->property_blob_size
+ n * header->function_blob_size; + n * header->function_blob_size;
return (GIFunctionInfo *) gi_info_new (GI_INFO_TYPE_FUNCTION, (GIBaseInfo*)info, return (GIFunctionInfo *) gi_base_info_new (GI_INFO_TYPE_FUNCTION, (GIBaseInfo*)info,
rinfo->typelib, offset); rinfo->typelib, offset);
} }
/** /**
@ -301,8 +301,8 @@ gi_interface_info_get_signal (GIInterfaceInfo *info,
+ blob->n_methods * header->function_blob_size + blob->n_methods * header->function_blob_size
+ n * header->signal_blob_size; + n * header->signal_blob_size;
return (GISignalInfo *) gi_info_new (GI_INFO_TYPE_SIGNAL, (GIBaseInfo*)info, return (GISignalInfo *) gi_base_info_new (GI_INFO_TYPE_SIGNAL, (GIBaseInfo*)info,
rinfo->typelib, offset); rinfo->typelib, offset);
} }
/** /**
@ -398,8 +398,8 @@ gi_interface_info_get_vfunc (GIInterfaceInfo *info,
+ blob->n_signals * header->signal_blob_size + blob->n_signals * header->signal_blob_size
+ n * header->vfunc_blob_size; + n * header->vfunc_blob_size;
return (GIVFuncInfo *) gi_info_new (GI_INFO_TYPE_VFUNC, (GIBaseInfo*)info, return (GIVFuncInfo *) gi_base_info_new (GI_INFO_TYPE_VFUNC, (GIBaseInfo*)info,
rinfo->typelib, offset); rinfo->typelib, offset);
} }
/** /**
@ -499,8 +499,8 @@ gi_interface_info_get_constant (GIInterfaceInfo *info,
+ blob->n_vfuncs * header->vfunc_blob_size + blob->n_vfuncs * header->vfunc_blob_size
+ n * header->constant_blob_size; + n * header->constant_blob_size;
return (GIConstantInfo *) gi_info_new (GI_INFO_TYPE_CONSTANT, (GIBaseInfo*)info, return (GIConstantInfo *) gi_base_info_new (GI_INFO_TYPE_CONSTANT, (GIBaseInfo*)info,
rinfo->typelib, offset); rinfo->typelib, offset);
} }
/** /**

View File

@ -330,7 +330,7 @@ gi_object_info_get_field (GIObjectInfo *info,
offset = gi_object_info_get_field_offset(info, n); offset = gi_object_info_get_field_offset(info, n);
return (GIFieldInfo *) gi_info_new (GI_INFO_TYPE_FIELD, (GIBaseInfo*)info, rinfo->typelib, offset); return (GIFieldInfo *) gi_base_info_new (GI_INFO_TYPE_FIELD, (GIBaseInfo*)info, rinfo->typelib, offset);
} }
/** /**
@ -388,8 +388,8 @@ gi_object_info_get_property (GIObjectInfo *info,
+ blob->n_field_callbacks * header->callback_blob_size + blob->n_field_callbacks * header->callback_blob_size
+ n * header->property_blob_size; + n * header->property_blob_size;
return (GIPropertyInfo *) gi_info_new (GI_INFO_TYPE_PROPERTY, (GIBaseInfo*)info, return (GIPropertyInfo *) gi_base_info_new (GI_INFO_TYPE_PROPERTY, (GIBaseInfo*)info,
rinfo->typelib, offset); rinfo->typelib, offset);
} }
/** /**
@ -450,8 +450,8 @@ gi_object_info_get_method (GIObjectInfo *info,
+ blob->n_properties * header->property_blob_size + blob->n_properties * header->property_blob_size
+ n * header->function_blob_size; + n * header->function_blob_size;
return (GIFunctionInfo *) gi_info_new (GI_INFO_TYPE_FUNCTION, (GIBaseInfo*)info, return (GIFunctionInfo *) gi_base_info_new (GI_INFO_TYPE_FUNCTION, (GIBaseInfo*)info,
rinfo->typelib, offset); rinfo->typelib, offset);
} }
/** /**
@ -615,8 +615,8 @@ gi_object_info_get_signal (GIObjectInfo *info,
+ blob->n_methods * header->function_blob_size + blob->n_methods * header->function_blob_size
+ n * header->signal_blob_size; + n * header->signal_blob_size;
return (GISignalInfo *) gi_info_new (GI_INFO_TYPE_SIGNAL, (GIBaseInfo*)info, return (GISignalInfo *) gi_base_info_new (GI_INFO_TYPE_SIGNAL, (GIBaseInfo*)info,
rinfo->typelib, offset); rinfo->typelib, offset);
} }
/** /**
@ -715,8 +715,8 @@ gi_object_info_get_vfunc (GIObjectInfo *info,
+ blob->n_signals * header->signal_blob_size + blob->n_signals * header->signal_blob_size
+ n * header->vfunc_blob_size; + n * header->vfunc_blob_size;
return (GIVFuncInfo *) gi_info_new (GI_INFO_TYPE_VFUNC, (GIBaseInfo*)info, return (GIVFuncInfo *) gi_base_info_new (GI_INFO_TYPE_VFUNC, (GIBaseInfo*)info,
rinfo->typelib, offset); rinfo->typelib, offset);
} }
/** /**
@ -895,8 +895,8 @@ gi_object_info_get_constant (GIObjectInfo *info,
+ blob->n_vfuncs * header->vfunc_blob_size + blob->n_vfuncs * header->vfunc_blob_size
+ n * header->constant_blob_size; + n * header->constant_blob_size;
return (GIConstantInfo *) gi_info_new (GI_INFO_TYPE_CONSTANT, (GIBaseInfo*)info, return (GIConstantInfo *) gi_base_info_new (GI_INFO_TYPE_CONSTANT, (GIBaseInfo*)info,
rinfo->typelib, offset); rinfo->typelib, offset);
} }
/** /**

View File

@ -111,8 +111,8 @@ gi_struct_info_get_field (GIStructInfo *info,
g_return_val_if_fail (n <= G_MAXUINT16, NULL); g_return_val_if_fail (n <= G_MAXUINT16, NULL);
return (GIFieldInfo *) gi_info_new (GI_INFO_TYPE_FIELD, (GIBaseInfo*)info, rinfo->typelib, return (GIFieldInfo *) gi_base_info_new (GI_INFO_TYPE_FIELD, (GIBaseInfo*)info, rinfo->typelib,
gi_struct_get_field_offset (info, n)); gi_struct_get_field_offset (info, n));
} }
/** /**
@ -143,10 +143,10 @@ gi_struct_info_find_field (GIStructInfo *info,
if (strcmp (name, fname) == 0) if (strcmp (name, fname) == 0)
{ {
return (GIFieldInfo *) gi_info_new (GI_INFO_TYPE_FIELD, return (GIFieldInfo *) gi_base_info_new (GI_INFO_TYPE_FIELD,
(GIBaseInfo* )info, (GIBaseInfo* )info,
rinfo->typelib, rinfo->typelib,
offset); offset);
} }
offset += header->field_blob_size; offset += header->field_blob_size;
@ -198,8 +198,8 @@ gi_struct_info_get_method (GIStructInfo *info,
g_return_val_if_fail (n <= G_MAXUINT16, NULL); g_return_val_if_fail (n <= G_MAXUINT16, NULL);
offset = gi_struct_get_field_offset (info, blob->n_fields) + n * header->function_blob_size; offset = gi_struct_get_field_offset (info, blob->n_fields) + n * header->function_blob_size;
return (GIFunctionInfo *) gi_info_new (GI_INFO_TYPE_FUNCTION, (GIBaseInfo*)info, return (GIFunctionInfo *) gi_base_info_new (GI_INFO_TYPE_FUNCTION, (GIBaseInfo*)info,
rinfo->typelib, offset); rinfo->typelib, offset);
} }
/** /**

View File

@ -211,8 +211,8 @@ gi_type_info_get_interface (GITypeInfo *info)
g_assert_not_reached (); g_assert_not_reached ();
return NULL; return NULL;
} }
return (GIBaseInfo *) gi_info_new (info_type, (GIBaseInfo*)info, rinfo->typelib, return (GIBaseInfo *) gi_base_info_new (info_type, (GIBaseInfo*)info, rinfo->typelib,
rinfo->offset); rinfo->offset);
} }
else else
{ {

View File

@ -80,9 +80,9 @@ gi_union_info_get_field (GIUnionInfo *info,
GIRealInfo *rinfo = (GIRealInfo *)info; GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header = (Header *)rinfo->typelib->data; Header *header = (Header *)rinfo->typelib->data;
return (GIFieldInfo *) gi_info_new (GI_INFO_TYPE_FIELD, (GIBaseInfo*)info, rinfo->typelib, return (GIFieldInfo *) gi_base_info_new (GI_INFO_TYPE_FIELD, (GIBaseInfo*)info, rinfo->typelib,
rinfo->offset + header->union_blob_size + rinfo->offset + header->union_blob_size +
n * header->field_blob_size); n * header->field_blob_size);
} }
/** /**
@ -126,8 +126,8 @@ gi_union_info_get_method (GIUnionInfo *info,
offset = rinfo->offset + header->union_blob_size offset = rinfo->offset + header->union_blob_size
+ blob->n_fields * header->field_blob_size + blob->n_fields * header->field_blob_size
+ n * header->function_blob_size; + n * header->function_blob_size;
return (GIFunctionInfo *) gi_info_new (GI_INFO_TYPE_FUNCTION, (GIBaseInfo*)info, return (GIFunctionInfo *) gi_base_info_new (GI_INFO_TYPE_FUNCTION, (GIBaseInfo*)info,
rinfo->typelib, offset); rinfo->typelib, offset);
} }
/** /**
@ -217,8 +217,8 @@ gi_union_info_get_discriminator (GIUnionInfo *info,
+ blob->n_functions * header->function_blob_size + blob->n_functions * header->function_blob_size
+ n * header->constant_blob_size; + n * header->constant_blob_size;
return (GIConstantInfo *) gi_info_new (GI_INFO_TYPE_CONSTANT, (GIBaseInfo*)info, return (GIConstantInfo *) gi_base_info_new (GI_INFO_TYPE_CONSTANT, (GIBaseInfo*)info,
rinfo->typelib, offset); rinfo->typelib, offset);
} }
return NULL; return NULL;

View File

@ -60,8 +60,8 @@ gi_base_info_find_vfunc (GIRealInfo *rinfo,
const char *fname = (const char *)&rinfo->typelib->data[fblob->name]; const char *fname = (const char *)&rinfo->typelib->data[fblob->name];
if (strcmp (name, fname) == 0) if (strcmp (name, fname) == 0)
return (GIVFuncInfo *) gi_info_new (GI_INFO_TYPE_VFUNC, (GIBaseInfo*) rinfo, return (GIVFuncInfo *) gi_base_info_new (GI_INFO_TYPE_VFUNC, (GIBaseInfo*) rinfo,
rinfo->typelib, offset); rinfo->typelib, offset);
offset += header->vfunc_blob_size; offset += header->vfunc_blob_size;
} }