girepository: Use gi_base_info_get_type() instead of field access

The `type` field will eventually disappear, so use an accessor method to
get it.

This introduces no functional changes.

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

Helps: #3155
This commit is contained in:
Philip Withnall 2023-11-28 17:19:51 +00:00
parent b5dedf88cb
commit aa50e6fd9d
3 changed files with 9 additions and 10 deletions

View File

@ -307,7 +307,7 @@ gi_base_info_get_name (GIBaseInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo*)info;
g_assert (rinfo->ref_count > 0);
switch (rinfo->type)
switch (gi_base_info_get_type ((GIBaseInfo *) info))
{
case GI_INFO_TYPE_FUNCTION:
case GI_INFO_TYPE_CALLBACK:
@ -407,7 +407,7 @@ gi_base_info_get_namespace (GIBaseInfo *info)
g_assert (rinfo->ref_count > 0);
if (rinfo->type == GI_INFO_TYPE_UNRESOLVED)
if (gi_base_info_get_type (info) == GI_INFO_TYPE_UNRESOLVED)
{
GIUnresolvedInfo *unresolved = (GIUnresolvedInfo *)info;
@ -430,7 +430,7 @@ gboolean
gi_base_info_is_deprecated (GIBaseInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo*) info;
switch (rinfo->type)
switch (gi_base_info_get_type ((GIBaseInfo *) info))
{
case GI_INFO_TYPE_FUNCTION:
case GI_INFO_TYPE_CALLBACK:

View File

@ -59,7 +59,7 @@ signature_offset (GICallableInfo *info)
GIRealInfo *rinfo = (GIRealInfo*)info;
int sigoff = -1;
switch (rinfo->type)
switch (gi_base_info_get_type ((GIBaseInfo *) info))
{
case GI_INFO_TYPE_FUNCTION:
sigoff = G_STRUCT_OFFSET (FunctionBlob, signature);
@ -105,7 +105,7 @@ gi_callable_info_can_throw_gerror (GICallableInfo *info)
* to support the other callables. For Functions and VFuncs,
* also check their legacy flag for compatibility.
*/
switch (rinfo->type) {
switch (gi_base_info_get_type ((GIBaseInfo *) info)) {
case GI_INFO_TYPE_FUNCTION:
{
FunctionBlob *blob;
@ -147,7 +147,7 @@ gboolean
gi_callable_info_is_method (GICallableInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo*)info;
switch (rinfo->type) {
switch (gi_base_info_get_type ((GIBaseInfo *) info)) {
case GI_INFO_TYPE_FUNCTION:
{
FunctionBlob *blob;

View File

@ -158,7 +158,7 @@ gi_function_info_get_flags (GIFunctionInfo *info)
GIPropertyInfo *
gi_function_info_get_property (GIFunctionInfo *info)
{
GIRealInfo *rinfo, *container_rinfo;
GIRealInfo *rinfo;
FunctionBlob *blob;
g_return_val_if_fail (info != NULL, NULL);
@ -166,15 +166,14 @@ gi_function_info_get_property (GIFunctionInfo *info)
rinfo = (GIRealInfo *)info;
blob = (FunctionBlob *)&rinfo->typelib->data[rinfo->offset];
container_rinfo = (GIRealInfo *)rinfo->container;
if (container_rinfo->type == GI_INFO_TYPE_INTERFACE)
if (gi_base_info_get_type ((GIBaseInfo *) rinfo->container) == GI_INFO_TYPE_INTERFACE)
{
GIInterfaceInfo *container = (GIInterfaceInfo *)rinfo->container;
return gi_interface_info_get_property (container, blob->index);
}
else if (container_rinfo->type == GI_INFO_TYPE_OBJECT)
else if (gi_base_info_get_type ((GIBaseInfo *) rinfo->container) == GI_INFO_TYPE_OBJECT)
{
GIObjectInfo *container = (GIObjectInfo *)rinfo->container;