2012-02-03 19:42:56 +01:00
|
|
|
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
|
|
|
|
|
* GObject introspection: Struct implementation
|
2010-06-07 00:52:12 +02:00
|
|
|
|
*
|
|
|
|
|
* Copyright (C) 2005 Matthias Clasen
|
|
|
|
|
* Copyright (C) 2008,2009 Red Hat, Inc.
|
|
|
|
|
*
|
2023-10-25 18:10:10 +02:00
|
|
|
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
|
|
|
|
*
|
2010-06-07 00:52:12 +02:00
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
|
*/
|
|
|
|
|
|
2014-07-04 12:27:41 +02:00
|
|
|
|
#include "config.h"
|
|
|
|
|
|
2015-06-03 13:59:11 +02:00
|
|
|
|
#include <string.h>
|
|
|
|
|
|
2010-06-07 00:52:12 +02:00
|
|
|
|
#include <glib.h>
|
|
|
|
|
|
2023-10-25 18:45:42 +02:00
|
|
|
|
#include <girepository/girepository.h>
|
2023-11-28 18:24:20 +01:00
|
|
|
|
#include "gibaseinfo-private.h"
|
2010-06-07 00:52:12 +02:00
|
|
|
|
#include "girepository-private.h"
|
|
|
|
|
#include "gitypelib-internal.h"
|
2023-10-25 19:11:38 +02:00
|
|
|
|
#include "gistructinfo.h"
|
2010-06-07 00:52:12 +02:00
|
|
|
|
|
2010-09-05 15:58:31 +02:00
|
|
|
|
/**
|
2023-12-13 14:25:33 +01:00
|
|
|
|
* GIStructInfo:
|
2010-09-05 15:58:31 +02:00
|
|
|
|
*
|
2023-12-13 14:25:33 +01:00
|
|
|
|
* `GIStructInfo` represents a generic C structure type.
|
2010-09-05 15:58:31 +02:00
|
|
|
|
*
|
|
|
|
|
* A structure has methods and fields.
|
2023-12-13 14:25:33 +01:00
|
|
|
|
*
|
|
|
|
|
* Since: 2.80
|
2010-09-05 15:58:31 +02:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
2023-11-08 15:17:52 +01:00
|
|
|
|
* gi_struct_info_get_n_fields:
|
2010-09-05 15:58:31 +02:00
|
|
|
|
* @info: a #GIStructInfo
|
|
|
|
|
*
|
|
|
|
|
* Obtain the number of fields this structure has.
|
|
|
|
|
*
|
|
|
|
|
* Returns: number of fields
|
2023-12-13 14:25:33 +01:00
|
|
|
|
* Since: 2.80
|
2010-09-05 15:58:31 +02:00
|
|
|
|
*/
|
2024-01-15 22:20:02 +01:00
|
|
|
|
unsigned int
|
2023-11-08 15:17:52 +01:00
|
|
|
|
gi_struct_info_get_n_fields (GIStructInfo *info)
|
2010-06-07 00:52:12 +02:00
|
|
|
|
{
|
|
|
|
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
|
|
|
|
StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
|
|
|
|
|
|
|
|
|
|
return blob->n_fields;
|
|
|
|
|
}
|
|
|
|
|
|
2010-09-05 15:58:31 +02:00
|
|
|
|
/**
|
2023-11-08 15:17:52 +01:00
|
|
|
|
* gi_struct_info_get_field_offset:
|
2010-09-05 15:58:31 +02:00
|
|
|
|
* @info: a #GIStructInfo
|
|
|
|
|
* @n: index of queried field
|
|
|
|
|
*
|
|
|
|
|
* Obtain the offset of the specified field.
|
|
|
|
|
*
|
2023-12-13 14:25:33 +01:00
|
|
|
|
* Returns: field offset, in bytes
|
|
|
|
|
* Since: 2.80
|
2010-09-05 15:58:31 +02:00
|
|
|
|
*/
|
2024-01-16 01:41:43 +01:00
|
|
|
|
static size_t
|
2023-11-08 15:17:52 +01:00
|
|
|
|
gi_struct_get_field_offset (GIStructInfo *info,
|
2024-01-16 01:41:43 +01:00
|
|
|
|
uint16_t n)
|
2010-06-07 00:52:12 +02:00
|
|
|
|
{
|
|
|
|
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
|
|
|
|
Header *header = (Header *)rinfo->typelib->data;
|
2024-01-16 01:41:43 +01:00
|
|
|
|
size_t offset = rinfo->offset + header->struct_blob_size;
|
2010-06-07 00:52:12 +02:00
|
|
|
|
FieldBlob *field_blob;
|
|
|
|
|
|
2024-01-16 01:41:43 +01:00
|
|
|
|
for (uint16_t i = 0; i < n; i++)
|
2010-06-07 00:52:12 +02:00
|
|
|
|
{
|
|
|
|
|
field_blob = (FieldBlob *)&rinfo->typelib->data[offset];
|
|
|
|
|
offset += header->field_blob_size;
|
|
|
|
|
if (field_blob->has_embedded_type)
|
|
|
|
|
offset += header->callback_blob_size;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
|
}
|
|
|
|
|
|
2010-09-05 15:58:31 +02:00
|
|
|
|
/**
|
2023-11-08 15:17:52 +01:00
|
|
|
|
* gi_struct_info_get_field:
|
2010-09-05 15:58:31 +02:00
|
|
|
|
* @info: a #GIStructInfo
|
|
|
|
|
* @n: a field index
|
|
|
|
|
*
|
|
|
|
|
* Obtain the type information for field with specified index.
|
|
|
|
|
*
|
2023-12-13 14:25:33 +01:00
|
|
|
|
* Returns: (transfer full): The [class@GIRepository.FieldInfo]. Free it with
|
|
|
|
|
* [method@GIRepository.BaseInfo.unref] when done.
|
|
|
|
|
* Since: 2.80
|
2010-09-05 15:58:31 +02:00
|
|
|
|
*/
|
2010-06-07 00:52:12 +02:00
|
|
|
|
GIFieldInfo *
|
2023-11-08 15:17:52 +01:00
|
|
|
|
gi_struct_info_get_field (GIStructInfo *info,
|
2024-01-15 22:20:02 +01:00
|
|
|
|
unsigned int n)
|
2010-06-07 00:52:12 +02:00
|
|
|
|
{
|
|
|
|
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
|
|
|
|
|
2024-01-16 01:40:09 +01:00
|
|
|
|
g_return_val_if_fail (n <= G_MAXUINT16, NULL);
|
|
|
|
|
|
2023-11-08 15:17:52 +01:00
|
|
|
|
return (GIFieldInfo *) gi_info_new (GI_INFO_TYPE_FIELD, (GIBaseInfo*)info, rinfo->typelib,
|
|
|
|
|
gi_struct_get_field_offset (info, n));
|
2010-06-07 00:52:12 +02:00
|
|
|
|
}
|
|
|
|
|
|
2015-06-03 13:59:11 +02:00
|
|
|
|
/**
|
2023-11-08 15:17:52 +01:00
|
|
|
|
* gi_struct_info_find_field:
|
2015-06-03 13:59:11 +02:00
|
|
|
|
* @info: a #GIStructInfo
|
|
|
|
|
* @name: a field name
|
|
|
|
|
*
|
|
|
|
|
* Obtain the type information for field named @name.
|
|
|
|
|
*
|
2023-12-13 14:25:33 +01:00
|
|
|
|
* Returns: (transfer full) (nullable): The [class@GIRepository.FieldInfo], or
|
|
|
|
|
* `NULL` if not found. Free it with [method@GIRepository.BaseInfo.unref] when
|
|
|
|
|
* done.
|
2023-11-09 00:24:11 +01:00
|
|
|
|
* Since: 2.80
|
2015-06-03 13:59:11 +02:00
|
|
|
|
*/
|
|
|
|
|
GIFieldInfo *
|
2023-11-08 15:17:52 +01:00
|
|
|
|
gi_struct_info_find_field (GIStructInfo *info,
|
2024-01-15 20:20:47 +01:00
|
|
|
|
const char *name)
|
2015-06-03 13:59:11 +02:00
|
|
|
|
{
|
|
|
|
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
|
|
|
|
StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
|
|
|
|
|
Header *header = (Header *)rinfo->typelib->data;
|
2024-01-16 01:00:07 +01:00
|
|
|
|
size_t offset = rinfo->offset + header->struct_blob_size;
|
2015-06-03 13:59:11 +02:00
|
|
|
|
|
2024-01-16 01:00:07 +01:00
|
|
|
|
for (size_t i = 0; i < blob->n_fields; i++)
|
2015-06-03 13:59:11 +02:00
|
|
|
|
{
|
|
|
|
|
FieldBlob *field_blob = (FieldBlob *)&rinfo->typelib->data[offset];
|
2024-01-15 20:20:47 +01:00
|
|
|
|
const char *fname = (const char *)&rinfo->typelib->data[field_blob->name];
|
2015-06-03 13:59:11 +02:00
|
|
|
|
|
|
|
|
|
if (strcmp (name, fname) == 0)
|
|
|
|
|
{
|
2023-11-08 15:17:52 +01:00
|
|
|
|
return (GIFieldInfo *) gi_info_new (GI_INFO_TYPE_FIELD,
|
|
|
|
|
(GIBaseInfo* )info,
|
|
|
|
|
rinfo->typelib,
|
|
|
|
|
offset);
|
2015-06-03 13:59:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
offset += header->field_blob_size;
|
|
|
|
|
if (field_blob->has_embedded_type)
|
|
|
|
|
offset += header->callback_blob_size;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2010-09-05 15:58:31 +02:00
|
|
|
|
/**
|
2023-11-08 15:17:52 +01:00
|
|
|
|
* gi_struct_info_get_n_methods:
|
2010-09-05 15:58:31 +02:00
|
|
|
|
* @info: a #GIStructInfo
|
|
|
|
|
*
|
|
|
|
|
* Obtain the number of methods this structure has.
|
|
|
|
|
*
|
|
|
|
|
* Returns: number of methods
|
2023-12-13 14:25:33 +01:00
|
|
|
|
* Since: 2.80
|
2010-09-05 15:58:31 +02:00
|
|
|
|
*/
|
2024-01-15 22:20:02 +01:00
|
|
|
|
unsigned int
|
2023-11-08 15:17:52 +01:00
|
|
|
|
gi_struct_info_get_n_methods (GIStructInfo *info)
|
2010-06-07 00:52:12 +02:00
|
|
|
|
{
|
|
|
|
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
|
|
|
|
StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
|
|
|
|
|
|
|
|
|
|
return blob->n_methods;
|
|
|
|
|
}
|
|
|
|
|
|
2010-09-05 15:58:31 +02:00
|
|
|
|
/**
|
2023-11-08 15:17:52 +01:00
|
|
|
|
* gi_struct_info_get_method:
|
2010-09-05 15:58:31 +02:00
|
|
|
|
* @info: a #GIStructInfo
|
|
|
|
|
* @n: a method index
|
|
|
|
|
*
|
|
|
|
|
* Obtain the type information for method with specified index.
|
|
|
|
|
*
|
2023-12-13 14:25:33 +01:00
|
|
|
|
* Returns: (transfer full): The [class@GIRepository.FunctionInfo]. Free it with
|
|
|
|
|
* [method@GIRepository.BaseInfo.unref] when done.
|
|
|
|
|
* Since: 2.80
|
2010-09-05 15:58:31 +02:00
|
|
|
|
*/
|
2010-06-07 00:52:12 +02:00
|
|
|
|
GIFunctionInfo *
|
2023-11-08 15:17:52 +01:00
|
|
|
|
gi_struct_info_get_method (GIStructInfo *info,
|
2024-01-15 22:20:02 +01:00
|
|
|
|
unsigned int n)
|
2010-06-07 00:52:12 +02:00
|
|
|
|
{
|
|
|
|
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
|
|
|
|
StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
|
|
|
|
|
Header *header = (Header *)rinfo->typelib->data;
|
2024-01-16 01:00:07 +01:00
|
|
|
|
size_t offset;
|
2010-06-07 00:52:12 +02:00
|
|
|
|
|
2024-01-16 01:40:09 +01:00
|
|
|
|
g_return_val_if_fail (n <= G_MAXUINT16, NULL);
|
|
|
|
|
|
2023-11-08 15:17:52 +01:00
|
|
|
|
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,
|
|
|
|
|
rinfo->typelib, offset);
|
2010-06-07 00:52:12 +02:00
|
|
|
|
}
|
|
|
|
|
|
2010-09-05 15:58:31 +02:00
|
|
|
|
/**
|
2023-11-08 15:17:52 +01:00
|
|
|
|
* gi_struct_info_find_method:
|
2010-09-05 15:58:31 +02:00
|
|
|
|
* @info: a #GIStructInfo
|
|
|
|
|
* @name: a method name
|
|
|
|
|
*
|
|
|
|
|
* Obtain the type information for method named @name.
|
|
|
|
|
*
|
2023-12-13 14:25:33 +01:00
|
|
|
|
* Returns: (transfer full) (nullable): The [class@GIRepository.FunctionInfo],
|
|
|
|
|
* or `NULL` if none was found. Free it with
|
|
|
|
|
* [method@GIRepository.BaseInfo.unref] when done.
|
|
|
|
|
* Since: 2.80
|
2010-09-05 15:58:31 +02:00
|
|
|
|
*/
|
2010-06-07 00:52:12 +02:00
|
|
|
|
GIFunctionInfo *
|
2023-11-08 15:17:52 +01:00
|
|
|
|
gi_struct_info_find_method (GIStructInfo *info,
|
2024-01-15 20:20:47 +01:00
|
|
|
|
const char *name)
|
2010-06-07 00:52:12 +02:00
|
|
|
|
{
|
2024-01-16 01:00:07 +01:00
|
|
|
|
size_t offset;
|
2010-06-07 00:52:12 +02:00
|
|
|
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
|
|
|
|
StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
|
|
|
|
|
|
2023-11-08 15:17:52 +01:00
|
|
|
|
offset = gi_struct_get_field_offset (info, blob->n_fields);
|
2023-11-08 16:23:31 +01:00
|
|
|
|
return gi_base_info_find_method ((GIBaseInfo*)info, offset, blob->n_methods, name);
|
2010-06-07 00:52:12 +02:00
|
|
|
|
}
|
|
|
|
|
|
2010-09-05 15:58:31 +02:00
|
|
|
|
/**
|
2023-11-08 15:17:52 +01:00
|
|
|
|
* gi_struct_info_get_size:
|
2010-09-05 15:58:31 +02:00
|
|
|
|
* @info: a #GIStructInfo
|
|
|
|
|
*
|
|
|
|
|
* Obtain the total size of the structure.
|
|
|
|
|
*
|
2023-12-13 14:25:33 +01:00
|
|
|
|
* Returns: size of the structure, in bytes
|
|
|
|
|
* Since: 2.80
|
2010-09-05 15:58:31 +02:00
|
|
|
|
*/
|
2024-01-16 00:35:23 +01:00
|
|
|
|
size_t
|
2023-11-08 15:17:52 +01:00
|
|
|
|
gi_struct_info_get_size (GIStructInfo *info)
|
2010-06-07 00:52:12 +02:00
|
|
|
|
{
|
|
|
|
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
|
|
|
|
StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
|
|
|
|
|
|
|
|
|
|
return blob->size;
|
|
|
|
|
}
|
|
|
|
|
|
2010-09-05 15:58:31 +02:00
|
|
|
|
/**
|
2023-11-08 15:17:52 +01:00
|
|
|
|
* gi_struct_info_get_alignment:
|
2010-09-05 15:58:31 +02:00
|
|
|
|
* @info: a #GIStructInfo
|
|
|
|
|
*
|
|
|
|
|
* Obtain the required alignment of the structure.
|
|
|
|
|
*
|
2023-12-13 14:25:33 +01:00
|
|
|
|
* Returns: required alignment, in bytes
|
|
|
|
|
* Since: 2.80
|
2010-09-05 15:58:31 +02:00
|
|
|
|
*/
|
2024-01-16 00:35:23 +01:00
|
|
|
|
size_t
|
2023-11-08 15:17:52 +01:00
|
|
|
|
gi_struct_info_get_alignment (GIStructInfo *info)
|
2010-06-07 00:52:12 +02:00
|
|
|
|
{
|
|
|
|
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
|
|
|
|
StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
|
|
|
|
|
|
|
|
|
|
return blob->alignment;
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-10 22:21:18 +02:00
|
|
|
|
/**
|
2023-11-08 15:17:52 +01:00
|
|
|
|
* gi_struct_info_is_foreign:
|
2023-12-13 14:25:33 +01:00
|
|
|
|
* @info: a #GIStructInfo
|
2013-10-10 22:21:18 +02:00
|
|
|
|
*
|
2023-12-13 14:25:33 +01:00
|
|
|
|
* Gets whether the structure is foreign, i.e. if it’s expected to be overridden
|
|
|
|
|
* by a native language binding instead of relying of introspected bindings.
|
2013-10-10 22:21:18 +02:00
|
|
|
|
*
|
2023-12-13 14:25:33 +01:00
|
|
|
|
* Returns: `TRUE` if the structure is foreign
|
|
|
|
|
* Since: 2.80
|
2013-10-10 22:21:18 +02:00
|
|
|
|
*/
|
2010-06-07 00:52:12 +02:00
|
|
|
|
gboolean
|
2023-11-08 15:17:52 +01:00
|
|
|
|
gi_struct_info_is_foreign (GIStructInfo *info)
|
2010-06-07 00:52:12 +02:00
|
|
|
|
{
|
|
|
|
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
|
|
|
|
StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
|
|
|
|
|
|
|
|
|
|
return blob->foreign;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2023-11-08 15:17:52 +01:00
|
|
|
|
* gi_struct_info_is_gtype_struct:
|
2010-06-07 00:52:12 +02:00
|
|
|
|
* @info: a #GIStructInfo
|
|
|
|
|
*
|
2023-12-13 14:25:33 +01:00
|
|
|
|
* Return true if this structure represents the ‘class structure’ for some
|
|
|
|
|
* [class@GObject.Object] or `GInterface`.
|
2010-06-07 00:52:12 +02:00
|
|
|
|
*
|
2023-12-13 14:25:33 +01:00
|
|
|
|
* This function is mainly useful to hide this kind of structure from generated
|
|
|
|
|
* public APIs.
|
|
|
|
|
*
|
|
|
|
|
* Returns: `TRUE` if this is a class struct, `FALSE` otherwise
|
|
|
|
|
* Since: 2.80
|
2010-06-07 00:52:12 +02:00
|
|
|
|
*/
|
|
|
|
|
gboolean
|
2023-11-08 15:17:52 +01:00
|
|
|
|
gi_struct_info_is_gtype_struct (GIStructInfo *info)
|
2010-06-07 00:52:12 +02:00
|
|
|
|
{
|
|
|
|
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
|
|
|
|
StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
|
|
|
|
|
|
|
|
|
|
return blob->is_gtype_struct;
|
|
|
|
|
}
|
2022-10-29 19:09:23 +02:00
|
|
|
|
|
|
|
|
|
/**
|
2023-12-12 19:18:51 +01:00
|
|
|
|
* gi_struct_info_get_copy_function_name:
|
2022-10-29 19:09:23 +02:00
|
|
|
|
* @info: a struct information blob
|
|
|
|
|
*
|
|
|
|
|
* Retrieves the name of the copy function for @info, if any is set.
|
|
|
|
|
*
|
2023-12-13 14:25:33 +01:00
|
|
|
|
* Returns: (transfer none) (nullable): the name of the copy function, or `NULL`
|
|
|
|
|
* if the structure has no copy function
|
2023-11-09 00:24:11 +01:00
|
|
|
|
* Since: 2.80
|
2022-10-29 19:09:23 +02:00
|
|
|
|
*/
|
|
|
|
|
const char *
|
2023-12-12 19:18:51 +01:00
|
|
|
|
gi_struct_info_get_copy_function_name (GIStructInfo *info)
|
2022-10-29 19:09:23 +02:00
|
|
|
|
{
|
|
|
|
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
|
|
|
|
StructBlob *blob;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (info != NULL, NULL);
|
|
|
|
|
g_return_val_if_fail (GI_IS_STRUCT_INFO (info), NULL);
|
|
|
|
|
|
|
|
|
|
blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
|
|
|
|
|
|
|
|
|
|
if (blob->copy_func)
|
2023-11-08 15:17:52 +01:00
|
|
|
|
return gi_typelib_get_string (rinfo->typelib, blob->copy_func);
|
2022-10-29 19:09:23 +02:00
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2023-12-12 19:18:51 +01:00
|
|
|
|
* gi_struct_info_get_free_function_name:
|
2022-10-29 19:09:23 +02:00
|
|
|
|
* @info: a struct information blob
|
|
|
|
|
*
|
|
|
|
|
* Retrieves the name of the free function for @info, if any is set.
|
|
|
|
|
*
|
2023-12-13 14:25:33 +01:00
|
|
|
|
* Returns: (transfer none) (nullable): the name of the free function, or `NULL`
|
|
|
|
|
* if the structure has no free function
|
2023-11-09 00:24:11 +01:00
|
|
|
|
* Since: 2.80
|
2022-10-29 19:09:23 +02:00
|
|
|
|
*/
|
|
|
|
|
const char *
|
2023-12-12 19:18:51 +01:00
|
|
|
|
gi_struct_info_get_free_function_name (GIStructInfo *info)
|
2022-10-29 19:09:23 +02:00
|
|
|
|
{
|
|
|
|
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
|
|
|
|
StructBlob *blob;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (info != NULL, NULL);
|
|
|
|
|
g_return_val_if_fail (GI_IS_STRUCT_INFO (info), NULL);
|
|
|
|
|
|
|
|
|
|
blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
|
|
|
|
|
|
|
|
|
|
if (blob->free_func)
|
2023-11-08 15:17:52 +01:00
|
|
|
|
return gi_typelib_get_string (rinfo->typelib, blob->free_func);
|
2022-10-29 19:09:23 +02:00
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2023-11-28 18:24:20 +01:00
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
gi_struct_info_class_init (gpointer g_class,
|
|
|
|
|
gpointer class_data)
|
|
|
|
|
{
|
|
|
|
|
GIBaseInfoClass *info_class = g_class;
|
|
|
|
|
|
|
|
|
|
info_class->info_type = GI_INFO_TYPE_STRUCT;
|
|
|
|
|
}
|