summaryrefslogtreecommitdiff
path: root/girepository/gistructinfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'girepository/gistructinfo.c')
-rw-r--r--girepository/gistructinfo.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/girepository/gistructinfo.c b/girepository/gistructinfo.c
index a9ad73f6..c13cb716 100644
--- a/girepository/gistructinfo.c
+++ b/girepository/gistructinfo.c
@@ -281,3 +281,57 @@ g_struct_info_is_gtype_struct (GIStructInfo *info)
return blob->is_gtype_struct;
}
+
+/**
+ * g_struct_info_get_copy_function:
+ * @info: a struct information blob
+ *
+ * Retrieves the name of the copy function for @info, if any is set.
+ *
+ * Returns: (transfer none) (nullable): the name of the copy function
+ *
+ * Since: 1.76
+ */
+const char *
+g_struct_info_get_copy_function (GIStructInfo *info)
+{
+ 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)
+ return g_typelib_get_string (rinfo->typelib, blob->copy_func);
+
+ return NULL;
+}
+
+/**
+ * g_struct_info_get_free_function:
+ * @info: a struct information blob
+ *
+ * Retrieves the name of the free function for @info, if any is set.
+ *
+ * Returns: (transfer none) (nullable): the name of the free function
+ *
+ * Since: 1.76
+ */
+const char *
+g_struct_info_get_free_function (GIStructInfo *info)
+{
+ 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)
+ return g_typelib_get_string (rinfo->typelib, blob->free_func);
+
+ return NULL;
+}