From e6556dd223a994d202b3486ce03930eaab4a29b8 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 5 May 2015 11:41:50 -0400 Subject: [PATCH] Use g_autoptr(GBytes) instead of gs_unref_bytes --- src/libostree/ostree-bootconfig-parser.c | 2 +- src/libostree/ostree-bootloader-syslinux.c | 2 +- src/libostree/ostree-bootloader-uboot.c | 2 +- src/libostree/ostree-fetcher.c | 2 +- src/libostree/ostree-repo-commit.c | 2 +- src/libostree/ostree-repo-pull.c | 14 +++++++------- .../ostree-repo-static-delta-compilation.c | 14 +++++++------- src/libostree/ostree-repo-static-delta-core.c | 2 +- .../ostree-repo-static-delta-processing.c | 4 ++-- src/libostree/ostree-repo.c | 14 +++++++------- src/libostree/ostree-sysroot-deploy.c | 2 +- 11 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/libostree/ostree-bootconfig-parser.c b/src/libostree/ostree-bootconfig-parser.c index 43f36caa..44e9ce80 100644 --- a/src/libostree/ostree-bootconfig-parser.c +++ b/src/libostree/ostree-bootconfig-parser.c @@ -169,7 +169,7 @@ ostree_bootconfig_parser_write (OstreeBootconfigParser *self, GHashTableIter hashiter; gpointer hashkey, hashvalue; GString *buf = g_string_new (""); - gs_unref_bytes GBytes *bytes = NULL; + g_autoptr(GBytes) bytes = NULL; guint i; gs_unref_hashtable GHashTable *written_overrides = NULL; diff --git a/src/libostree/ostree-bootloader-syslinux.c b/src/libostree/ostree-bootloader-syslinux.c index 0a083f31..72d9d1fc 100644 --- a/src/libostree/ostree-bootloader-syslinux.c +++ b/src/libostree/ostree-bootloader-syslinux.c @@ -247,7 +247,7 @@ _ostree_bootloader_syslinux_write_config (OstreeBootloader *bootloader, new_config_contents = _ostree_sysroot_join_lines (new_lines); { - gs_unref_bytes GBytes *new_config_contents_bytes = + g_autoptr(GBytes) new_config_contents_bytes = g_bytes_new_static (new_config_contents, strlen (new_config_contents)); diff --git a/src/libostree/ostree-bootloader-uboot.c b/src/libostree/ostree-bootloader-uboot.c index 7e71ab9e..00ec2d69 100644 --- a/src/libostree/ostree-bootloader-uboot.c +++ b/src/libostree/ostree-bootloader-uboot.c @@ -129,7 +129,7 @@ _ostree_bootloader_uboot_write_config (OstreeBootloader *bootloader, new_config_contents = _ostree_sysroot_join_lines (new_lines); { - gs_unref_bytes GBytes *new_config_contents_bytes = + g_autoptr(GBytes) new_config_contents_bytes = g_bytes_new_static (new_config_contents, strlen (new_config_contents)); diff --git a/src/libostree/ostree-fetcher.c b/src/libostree/ostree-fetcher.c index c50a0964..e7dc00de 100644 --- a/src/libostree/ostree-fetcher.c +++ b/src/libostree/ostree-fetcher.c @@ -380,7 +380,7 @@ on_stream_read (GObject *object, gpointer user_data) { OstreeFetcherPendingURI *pending = user_data; - gs_unref_bytes GBytes *bytes = NULL; + g_autoptr(GBytes) bytes = NULL; gsize bytes_read; GError *local_error = NULL; GError **error = &local_error; diff --git a/src/libostree/ostree-repo-commit.c b/src/libostree/ostree-repo-commit.c index d26f00e8..bb1cef28 100644 --- a/src/libostree/ostree-repo-commit.c +++ b/src/libostree/ostree-repo-commit.c @@ -597,7 +597,7 @@ write_object (OstreeRepo *self, if (repo_mode == OSTREE_REPO_MODE_BARE_USER && object_is_symlink) { const char *target_str = g_file_info_get_symlink_target (file_info); - gs_unref_bytes GBytes *target = g_bytes_new (target_str, strlen (target_str) + 1); + g_autoptr(GBytes) target = g_bytes_new (target_str, strlen (target_str) + 1); /* For bare-user we can't store symlinks as symlinks, as symlinks don't support user xattrs to store the ownership. So, instead store them diff --git a/src/libostree/ostree-repo-pull.c b/src/libostree/ostree-repo-pull.c index 0758970b..433f3f5e 100644 --- a/src/libostree/ostree-repo-pull.c +++ b/src/libostree/ostree-repo-pull.c @@ -323,7 +323,7 @@ fetch_uri_contents_utf8_sync (OtPullData *pull_data, GError **error) { gboolean ret = FALSE; - gs_unref_bytes GBytes *bytes = NULL; + g_autoptr(GBytes) bytes = NULL; g_autofree char *ret_contents = NULL; gsize len; @@ -519,7 +519,7 @@ lookup_commit_checksum_from_summary (OtPullData *pull_data, gs_unref_variant GVariant *commit_data = NULL; guint64 commit_size; gs_unref_variant GVariant *commit_csum_v = NULL; - gs_unref_bytes GBytes *commit_bytes = NULL; + g_autoptr(GBytes) commit_bytes = NULL; int i; if (!ot_variant_bsearch_str (refs, ref, &i)) @@ -895,7 +895,7 @@ static_deltapart_fetch_on_complete (GObject *object, { GMappedFile *mfile = NULL; - gs_unref_bytes GBytes *delta_data = NULL; + g_autoptr(GBytes) delta_data = NULL; mfile = g_mapped_file_new_from_fd (fd, FALSE, error); if (!mfile) @@ -1311,7 +1311,7 @@ fetch_metadata_to_verify_delta_superblock (OtPullData *pull_data, { gboolean ret = FALSE; g_autofree char *meta_path = _ostree_get_relative_static_delta_detachedmeta_path (from_revision, checksum); - gs_unref_bytes GBytes *detached_meta_data = NULL; + g_autoptr(GBytes) detached_meta_data = NULL; SoupURI *target_uri = NULL; gs_unref_variant GVariant *metadata = NULL; @@ -1351,8 +1351,8 @@ request_static_delta_superblock_sync (OtPullData *pull_data, gs_unref_variant GVariant *ret_delta_superblock = NULL; g_autofree char *delta_name = _ostree_get_relative_static_delta_superblock_path (from_revision, to_revision); - gs_unref_bytes GBytes *delta_superblock_data = NULL; - gs_unref_bytes GBytes *delta_meta_data = NULL; + g_autoptr(GBytes) delta_superblock_data = NULL; + g_autoptr(GBytes) delta_meta_data = NULL; gs_unref_variant GVariant *delta_superblock = NULL; SoupURI *target_uri = NULL; @@ -1907,7 +1907,7 @@ ostree_repo_pull_with_options (OstreeRepo *self, if (pull_data->is_mirror && !refs_to_fetch && !configured_branches) { SoupURI *summary_uri = NULL; - gs_unref_bytes GBytes *bytes = NULL; + g_autoptr(GBytes) bytes = NULL; g_autofree char *ret_contents = NULL; summary_uri = suburi_new (pull_data->base_uri, "summary", NULL); diff --git a/src/libostree/ostree-repo-static-delta-compilation.c b/src/libostree/ostree-repo-static-delta-compilation.c index 854008f3..b2e206e8 100644 --- a/src/libostree/ostree-repo-static-delta-compilation.c +++ b/src/libostree/ostree-repo-static-delta-compilation.c @@ -455,7 +455,7 @@ get_unpacked_unlinked_content (OstreeRepo *repo, gboolean ret = FALSE; g_autofree char *tmpname = g_strdup ("tmpostree-deltaobj-XXXXXX"); gs_fd_close int fd = -1; - gs_unref_bytes GBytes *ret_content = NULL; + g_autoptr(GBytes) ret_content = NULL; g_autoptr(GInputStream) istream = NULL; g_autoptr(GFileInfo) ret_finfo = NULL; g_autoptr(GOutputStream) out = NULL; @@ -506,8 +506,8 @@ try_content_bsdiff (OstreeRepo *repo, gboolean ret = FALSE; gs_unref_hashtable GHashTable *from_bsdiff = NULL; gs_unref_hashtable GHashTable *to_bsdiff = NULL; - gs_unref_bytes GBytes *tmp_from = NULL; - gs_unref_bytes GBytes *tmp_to = NULL; + g_autoptr(GBytes) tmp_from = NULL; + g_autoptr(GBytes) tmp_to = NULL; g_autoptr(GFileInfo) from_finfo = NULL; g_autoptr(GFileInfo) to_finfo = NULL; ContentBsdiff *ret_bsdiff = NULL; @@ -548,8 +548,8 @@ try_content_rollsum (OstreeRepo *repo, gboolean ret = FALSE; gs_unref_hashtable GHashTable *from_rollsum = NULL; gs_unref_hashtable GHashTable *to_rollsum = NULL; - gs_unref_bytes GBytes *tmp_from = NULL; - gs_unref_bytes GBytes *tmp_to = NULL; + g_autoptr(GBytes) tmp_from = NULL; + g_autoptr(GBytes) tmp_to = NULL; g_autoptr(GFileInfo) from_finfo = NULL; g_autoptr(GFileInfo) to_finfo = NULL; OstreeRollsumMatches *matches = NULL; @@ -1301,8 +1301,8 @@ ostree_repo_static_delta_generate (OstreeRepo *self, GBytes *operations_b; g_autofree guchar *part_checksum = NULL; g_autoptr(GChecksum) checksum = NULL; - gs_unref_bytes GBytes *objtype_checksum_array = NULL; - gs_unref_bytes GBytes *checksum_bytes = NULL; + g_autoptr(GBytes) objtype_checksum_array = NULL; + g_autoptr(GBytes) checksum_bytes = NULL; g_autoptr(GFile) part_tempfile = NULL; g_autoptr(GOutputStream) part_temp_outstream = NULL; g_autoptr(GInputStream) part_in = NULL; diff --git a/src/libostree/ostree-repo-static-delta-core.c b/src/libostree/ostree-repo-static-delta-core.c index 264a8893..63e4d7fe 100644 --- a/src/libostree/ostree-repo-static-delta-core.c +++ b/src/libostree/ostree-repo-static-delta-core.c @@ -318,7 +318,7 @@ ostree_repo_static_delta_execute_offline (OstreeRepo *self, { GMappedFile *mfile = gs_file_map_noatime (part_path, cancellable, error); - gs_unref_bytes GBytes *bytes = NULL; + g_autoptr(GBytes) bytes = NULL; if (!mfile) goto out; diff --git a/src/libostree/ostree-repo-static-delta-processing.c b/src/libostree/ostree-repo-static-delta-processing.c index 32e6157e..8c627570 100644 --- a/src/libostree/ostree-repo-static-delta-processing.c +++ b/src/libostree/ostree-repo-static-delta-processing.c @@ -319,8 +319,8 @@ _ostree_static_delta_part_execute (OstreeRepo *repo, gboolean ret = FALSE; gsize partlen; const guint8*partdata; - gs_unref_bytes GBytes *part_payload_bytes = NULL; - gs_unref_bytes GBytes *payload_data = NULL; + g_autoptr(GBytes) part_payload_bytes = NULL; + g_autoptr(GBytes) payload_data = NULL; gs_unref_variant GVariant *payload = NULL; guint8 comptype; diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c index a03e894c..d21124ff 100644 --- a/src/libostree/ostree-repo.c +++ b/src/libostree/ostree-repo.c @@ -2032,7 +2032,7 @@ ostree_repo_load_file (OstreeRepo *self, { guint32 mode; gs_unref_variant GVariant *metadata = NULL; - gs_unref_bytes GBytes *bytes = NULL; + g_autoptr(GBytes) bytes = NULL; gs_fd_close int fd = -1; bytes = ot_lgetxattrat (self->objects_dir_fd, loose_path_buf, @@ -3103,7 +3103,7 @@ sign_data (OstreeRepo *self, g_autoptr(GFile) tmp_signature_file = NULL; g_autoptr(GOutputStream) tmp_signature_output = NULL; gpgme_ctx_t context = NULL; - gs_unref_bytes GBytes *ret_signature = NULL; + g_autoptr(GBytes) ret_signature = NULL; gpgme_engine_info_t info; gpgme_error_t err; gpgme_key_t key = NULL; @@ -3248,8 +3248,8 @@ ostree_repo_sign_commit (OstreeRepo *self, GError **error) { gboolean ret = FALSE; - gs_unref_bytes GBytes *commit_data = NULL; - gs_unref_bytes GBytes *signature = NULL; + g_autoptr(GBytes) commit_data = NULL; + g_autoptr(GBytes) signature = NULL; gs_unref_variant GVariant *commit_variant = NULL; gs_unref_variant GVariant *old_metadata = NULL; gs_unref_variant GVariant *new_metadata = NULL; @@ -3342,8 +3342,8 @@ ostree_repo_sign_delta (OstreeRepo *self, GError **error) { gboolean ret = FALSE; - gs_unref_bytes GBytes *delta_data = NULL; - gs_unref_bytes GBytes *signature_data = NULL; + g_autoptr(GBytes) delta_data = NULL; + g_autoptr(GBytes) signature_data = NULL; gs_unref_variant GVariant *commit_variant = NULL; g_autofree char *delta_path = NULL; g_autoptr(GFile) delta_file = NULL; @@ -3537,7 +3537,7 @@ ostree_repo_verify_commit_ext (OstreeRepo *self, gs_unref_variant GVariant *commit_variant = NULL; g_autoptr(GFile) keyringdir_ref = NULL; gs_unref_variant GVariant *metadata = NULL; - gs_unref_bytes GBytes *signed_data = NULL; + g_autoptr(GBytes) signed_data = NULL; g_autofree char *commit_filename = NULL; /* Create a temporary file for the commit */ diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c index 5e1ec445..34ab23eb 100644 --- a/src/libostree/ostree-sysroot-deploy.c +++ b/src/libostree/ostree-sysroot-deploy.c @@ -853,7 +853,7 @@ ostree_sysroot_write_origin_file (OstreeSysroot *sysroot, g_autoptr(GFile) origin_parent = g_file_get_parent (origin_path); g_autofree char *contents = NULL; gsize len; - gs_unref_bytes GBytes *contents_bytes = NULL; + g_autoptr(GBytes) contents_bytes = NULL; contents = g_key_file_to_data (origin, &len, error); if (!contents)