Define an initializer for GVariant{Builder,Dict}

So we build warning-free on GLib (< 2.50, >= 2.50).  This
is a band aid until we hard-require >= 2.50.

Closes: #547
Approved by: jlebon
This commit is contained in:
Colin Walters authored and Atomic Bot committed 2016-10-27 18:49:15 +00:00
1 parent cde7928496
commit 7f2960db43
4 files changed
+14 -8

No files matched your search

+1 -2
View File
@@ -33,8 +33,7 @@
GVariant *
ot_gvariant_new_empty_string_dict (void)
{
g_auto(GVariantBuilder) builder = {{0,}};
g_auto(GVariantBuilder) builder = OT_VARIANT_BUILDER_INITIALIZER;
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
return g_variant_builder_end (&builder);
}
+7
View File
@@ -26,6 +26,13 @@
#include <string.h> /* Yeah...let's just do that here. */
#include <libglnx.h>
/* https://bugzilla.gnome.org/show_bug.cgi?id=766370 */
#if !GLIB_CHECK_VERSION(2, 49, 3)
#define OT_VARIANT_BUILDER_INITIALIZER {{0,}}
#else
#define OT_VARIANT_BUILDER_INITIALIZER {{{0,}}}
#endif
#define ot_gobject_refz(o) (o ? g_object_ref (o) : o)
#define ot_transfer_out_value(outp, srcp) G_STMT_START { \