shared: add NM_G_VARIANT_TYPE() macro

Like G_VARIANT_TYPE(), but this one can be used to initialize a static variable.
This commit is contained in:
Thomas Haller 2019-09-22 15:33:42 +02:00
parent dce1aa87c2
commit df6714102c

View file

@ -1262,6 +1262,14 @@ nm_clear_g_cancellable_disconnect (GCancellable *cancellable, gulong *cancellabl
/*****************************************************************************/
/* GVariantType is basically a C string. But G_VARIANT_TYPE() is not suitable
* to initialize a static variable (because it evaluates a function check that
* the string is valid). Add an alternative macro that does the plain cast.
*
* Here you loose the assertion check that G_VARIANT_TYPE() to ensure the
* string is valid. */
#define NM_G_VARIANT_TYPE(fmt) ((const GVariantType *) (""fmt""))
static inline GVariant *
nm_g_variant_ref (GVariant *v)
{