mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-05 10:38:08 +01:00
Add a method to compare infos
Add g_base_info_equal.
This commit is contained in:
parent
43f1c2db17
commit
46e36632af
20
ginfo.c
20
ginfo.c
@ -554,6 +554,26 @@ g_base_info_get_typelib (GIBaseInfo *info)
|
||||
return info->typelib;
|
||||
}
|
||||
|
||||
/*
|
||||
* g_base_info_equal:
|
||||
* @info1: A #GIBaseInfo
|
||||
* @info2: A #GIBaseInfo
|
||||
*
|
||||
* Compare two #GIBaseInfo.
|
||||
*
|
||||
* Using pointer comparison is not practical since many functions return
|
||||
* different instances of #GIBaseInfo that refers to the same part of the
|
||||
* TypeLib; use this function instead to do #GIBaseInfo comparisons.
|
||||
*
|
||||
* Return value: TRUE if and only if @info1 equals @info2.
|
||||
*/
|
||||
gboolean
|
||||
g_base_info_equal (GIBaseInfo *info1, GIBaseInfo *info2)
|
||||
{
|
||||
/* Compare the TypeLib pointers, which are mmapped. */
|
||||
return info1->typelib->data + info1->offset == info2->typelib->data + info2->offset;
|
||||
}
|
||||
|
||||
/* GIFunctionInfo functions */
|
||||
const gchar *
|
||||
g_function_info_get_symbol (GIFunctionInfo *info)
|
||||
|
@ -203,6 +203,8 @@ gboolean g_base_info_iterate_attributes (GIBaseInfo *info,
|
||||
char **value);
|
||||
GIBaseInfo * g_base_info_get_container (GIBaseInfo *info);
|
||||
GTypelib * g_base_info_get_typelib (GIBaseInfo *info);
|
||||
gboolean g_base_info_equal (GIBaseInfo *info1,
|
||||
GIBaseInfo *info2);
|
||||
|
||||
GIBaseInfo * g_info_new (GIInfoType type,
|
||||
GIBaseInfo *container,
|
||||
|
Loading…
x
Reference in New Issue
Block a user