shared: add nm_g_variant_ref() and nm_g_variant_unref() helpers

Akin to nm_g_object_ref() and nm_g_object_unref().
This commit is contained in:
Thomas Haller 2019-01-07 14:29:15 +01:00
parent 240e2bd9f8
commit 2a6e7e917f

View file

@ -1129,6 +1129,23 @@ nm_clear_g_cancellable (GCancellable **cancellable)
/*****************************************************************************/
static inline GVariant *
nm_g_variant_ref (GVariant *v)
{
if (v)
g_variant_ref (v);
return v;
}
static inline void
nm_g_variant_unref (GVariant *v)
{
if (v)
g_variant_unref (v);
}
/*****************************************************************************/
/* Determine whether @x is a power of two (@x being an integer type).
* Basically, this returns TRUE, if @x has exactly one bit set.
* For negative values and zero, this always returns FALSE. */