diff options
author | Thomas Haller <thaller@redhat.com> | 2019-09-22 15:33:42 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-09-30 08:23:19 +0200 |
commit | df6714102c3968bd2d5516bd8441435cee2fc689 (patch) | |
tree | 7667f1c40f1091b3e25590054926cc399dac728f | |
parent | dce1aa87c28a7ecd4611984d543295e8623a1331 (diff) | |
download | NetworkManager-df6714102c3968bd2d5516bd8441435cee2fc689.tar.gz |
shared: add NM_G_VARIANT_TYPE() macro
Like G_VARIANT_TYPE(), but this one can be used to initialize a static variable.
-rw-r--r-- | shared/nm-glib-aux/nm-macros-internal.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/shared/nm-glib-aux/nm-macros-internal.h b/shared/nm-glib-aux/nm-macros-internal.h index 9292f3699d..09f96ef6ba 100644 --- a/shared/nm-glib-aux/nm-macros-internal.h +++ b/shared/nm-glib-aux/nm-macros-internal.h @@ -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) { |