mirror of
https://github.com/ostreedev/ostree.git
synced 2025-01-09 01:18:35 +03:00
core: Add ot_util_variant_take_ref for older GLib versions
This commit is contained in:
parent
8b43c539cf
commit
9a8736203d
@ -358,7 +358,7 @@ ostree_parse_metadata_file (const char *path,
|
||||
|
||||
ret = TRUE;
|
||||
*out_type = ret_type;
|
||||
*out_variant = g_variant_take_ref (ret_variant);
|
||||
*out_variant = ot_util_variant_take_ref (ret_variant);
|
||||
ret_variant = NULL;
|
||||
out:
|
||||
if (ret_variant)
|
||||
|
@ -75,6 +75,18 @@ ot_util_variant_save (GFile *dest,
|
||||
return ret;
|
||||
}
|
||||
|
||||
GVariant *
|
||||
ot_util_variant_take_ref (GVariant *variant)
|
||||
{
|
||||
#if GLIB_CHECK_VERSION(2,32,0)
|
||||
return g_variant_take_ref (variant);
|
||||
#else
|
||||
if (g_variant_is_floating (variant))
|
||||
return g_variant_ref_sink (variant);
|
||||
return variant;
|
||||
#endif
|
||||
}
|
||||
|
||||
gboolean
|
||||
ot_util_variant_map (GFile *src,
|
||||
const GVariantType *type,
|
||||
|
@ -28,6 +28,8 @@ G_BEGIN_DECLS
|
||||
|
||||
GHashTable *ot_util_variant_asv_to_hash_table (GVariant *variant);
|
||||
|
||||
GVariant * ot_util_variant_take_ref (GVariant *variant);
|
||||
|
||||
gboolean ot_util_variant_save (GFile *dest,
|
||||
GVariant *variant,
|
||||
GCancellable *cancellable,
|
||||
|
Loading…
Reference in New Issue
Block a user