Use g_memdup2() with newer versions of GLib

The g_memdup() function has been deprecated, so we should use the new
g_memdup2() function if available.
This commit is contained in:
Emmanuele Bassi 2021-03-12 18:54:47 +00:00
parent b305534719
commit 7cfb47308b

View File

@ -128,7 +128,15 @@ g_constant_info_get_value (GIConstantInfo *info,
if (blob->type.flags.reserved == 0 && blob->type.flags.reserved2 == 0)
{
if (blob->type.flags.pointer)
value->v_pointer = g_memdup (&rinfo->typelib->data[blob->offset], blob->size);
{
#if GLIB_CHECK_VERSION (2, 67, 5)
gsize blob_size = blob->size;
value->v_pointer = g_memdup2 (&rinfo->typelib->data[blob->offset], blob_size);
#else
value->v_pointer = g_memdup (&rinfo->typelib->data[blob->offset], blob->size);
#endif
}
else
{
switch (blob->type.flags.tag)