diff options
author | Colin Walters <walters@verbum.org> | 2016-10-25 12:07:16 -0400 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2016-10-27 18:49:15 +0000 |
commit | 7f2960db431496a73bd8e4b2c653a18f37e15151 (patch) | |
tree | 20ddbb6c84522ffd581be91cea6738583e461f34 /src | |
parent | cde792849695acacf6b69712e2a4f7a721807fec (diff) | |
download | ostree-7f2960db431496a73bd8e4b2c653a18f37e15151.tar.gz |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/libostree/ostree-repo-static-delta-compilation.c | 6 | ||||
-rw-r--r-- | src/libostree/ostree-repo.c | 6 | ||||
-rw-r--r-- | src/libotutil/ot-variant-utils.c | 3 | ||||
-rw-r--r-- | src/libotutil/otutil.h | 7 |
4 files changed, 14 insertions, 8 deletions
diff --git a/src/libostree/ostree-repo-static-delta-compilation.c b/src/libostree/ostree-repo-static-delta-compilation.c index d73bdc83..fef204c7 100644 --- a/src/libostree/ostree-repo-static-delta-compilation.c +++ b/src/libostree/ostree-repo-static-delta-compilation.c @@ -1255,7 +1255,7 @@ ostree_repo_static_delta_generate (OstreeRepo *self, guint min_fallback_size; guint max_bsdiff_size; guint max_chunk_size; - g_auto(GVariantBuilder) metadata_builder = {{0,}}; + g_auto(GVariantBuilder) metadata_builder = OT_VARIANT_BUILDER_INITIALIZER; DeltaOpts delta_opts = DELTAOPT_FLAG_NONE; guint64 total_compressed_size = 0; guint64 total_uncompressed_size = 0; @@ -1391,8 +1391,8 @@ ostree_repo_static_delta_generate (OstreeRepo *self, g_autoptr(GVariant) delta_part_content = NULL; g_autoptr(GVariant) delta_part = NULL; g_autoptr(GVariant) delta_part_header = NULL; - g_auto(GVariantBuilder) mode_builder = {{0,}}; - g_auto(GVariantBuilder) xattr_builder = {{0,}}; + g_auto(GVariantBuilder) mode_builder = OT_VARIANT_BUILDER_INITIALIZER; + g_auto(GVariantBuilder) xattr_builder = OT_VARIANT_BUILDER_INITIALIZER; guint8 compression_type_char; g_variant_builder_init (&mode_builder, G_VARIANT_TYPE ("a(uuu)")); diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c index 305588a9..c897f819 100644 --- a/src/libostree/ostree-repo.c +++ b/src/libostree/ostree-repo.c @@ -3164,7 +3164,7 @@ ostree_repo_delete_object (OstreeRepo *self, if (tombstone_commits) { - g_auto(GVariantBuilder) builder = {{0,}}; + g_auto(GVariantBuilder) builder = OT_VARIANT_BUILDER_INITIALIZER; g_autoptr(GVariant) variant = NULL; g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); @@ -4653,7 +4653,7 @@ ostree_repo_regenerate_summary (OstreeRepo *self, g_autoptr(GVariant) summary = NULL; GList *ordered_keys = NULL; GList *iter = NULL; - g_auto(GVariantDict) additional_metadata_builder = {{0,}}; + g_auto(GVariantDict) additional_metadata_builder = OT_VARIANT_BUILDER_INITIALIZER; if (!ostree_repo_list_refs (self, NULL, &refs, cancellable, error)) goto out; @@ -4686,7 +4686,7 @@ ostree_repo_regenerate_summary (OstreeRepo *self, { guint i; g_autoptr(GPtrArray) delta_names = NULL; - g_auto(GVariantDict) deltas_builder = {{0,}}; + g_auto(GVariantDict) deltas_builder = OT_VARIANT_BUILDER_INITIALIZER; if (!ostree_repo_list_static_delta_names (self, &delta_names, cancellable, error)) goto out; diff --git a/src/libotutil/ot-variant-utils.c b/src/libotutil/ot-variant-utils.c index 315bbeb2..1c4c5efa 100644 --- a/src/libotutil/ot-variant-utils.c +++ b/src/libotutil/ot-variant-utils.c @@ -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); } diff --git a/src/libotutil/otutil.h b/src/libotutil/otutil.h index ec516f65..c66d5634 100644 --- a/src/libotutil/otutil.h +++ b/src/libotutil/otutil.h @@ -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 { \ |