Use g_autoptr(GBytes) instead of gs_unref_bytes

This commit is contained in:
Matthew Barnes 2015-05-05 11:41:50 -04:00
parent 3f044267b5
commit e6556dd223
11 changed files with 30 additions and 30 deletions

View File

@ -169,7 +169,7 @@ ostree_bootconfig_parser_write (OstreeBootconfigParser *self,
GHashTableIter hashiter; GHashTableIter hashiter;
gpointer hashkey, hashvalue; gpointer hashkey, hashvalue;
GString *buf = g_string_new (""); GString *buf = g_string_new ("");
gs_unref_bytes GBytes *bytes = NULL; g_autoptr(GBytes) bytes = NULL;
guint i; guint i;
gs_unref_hashtable GHashTable *written_overrides = NULL; gs_unref_hashtable GHashTable *written_overrides = NULL;

View File

@ -247,7 +247,7 @@ _ostree_bootloader_syslinux_write_config (OstreeBootloader *bootloader,
new_config_contents = _ostree_sysroot_join_lines (new_lines); 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, g_bytes_new_static (new_config_contents,
strlen (new_config_contents)); strlen (new_config_contents));

View File

@ -129,7 +129,7 @@ _ostree_bootloader_uboot_write_config (OstreeBootloader *bootloader,
new_config_contents = _ostree_sysroot_join_lines (new_lines); 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, g_bytes_new_static (new_config_contents,
strlen (new_config_contents)); strlen (new_config_contents));

View File

@ -380,7 +380,7 @@ on_stream_read (GObject *object,
gpointer user_data) gpointer user_data)
{ {
OstreeFetcherPendingURI *pending = user_data; OstreeFetcherPendingURI *pending = user_data;
gs_unref_bytes GBytes *bytes = NULL; g_autoptr(GBytes) bytes = NULL;
gsize bytes_read; gsize bytes_read;
GError *local_error = NULL; GError *local_error = NULL;
GError **error = &local_error; GError **error = &local_error;

View File

@ -597,7 +597,7 @@ write_object (OstreeRepo *self,
if (repo_mode == OSTREE_REPO_MODE_BARE_USER && object_is_symlink) if (repo_mode == OSTREE_REPO_MODE_BARE_USER && object_is_symlink)
{ {
const char *target_str = g_file_info_get_symlink_target (file_info); 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 /* 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 support user xattrs to store the ownership. So, instead store them

View File

@ -323,7 +323,7 @@ fetch_uri_contents_utf8_sync (OtPullData *pull_data,
GError **error) GError **error)
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
gs_unref_bytes GBytes *bytes = NULL; g_autoptr(GBytes) bytes = NULL;
g_autofree char *ret_contents = NULL; g_autofree char *ret_contents = NULL;
gsize len; gsize len;
@ -519,7 +519,7 @@ lookup_commit_checksum_from_summary (OtPullData *pull_data,
gs_unref_variant GVariant *commit_data = NULL; gs_unref_variant GVariant *commit_data = NULL;
guint64 commit_size; guint64 commit_size;
gs_unref_variant GVariant *commit_csum_v = NULL; gs_unref_variant GVariant *commit_csum_v = NULL;
gs_unref_bytes GBytes *commit_bytes = NULL; g_autoptr(GBytes) commit_bytes = NULL;
int i; int i;
if (!ot_variant_bsearch_str (refs, ref, &i)) if (!ot_variant_bsearch_str (refs, ref, &i))
@ -895,7 +895,7 @@ static_deltapart_fetch_on_complete (GObject *object,
{ {
GMappedFile *mfile = NULL; 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); mfile = g_mapped_file_new_from_fd (fd, FALSE, error);
if (!mfile) if (!mfile)
@ -1311,7 +1311,7 @@ fetch_metadata_to_verify_delta_superblock (OtPullData *pull_data,
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
g_autofree char *meta_path = _ostree_get_relative_static_delta_detachedmeta_path (from_revision, checksum); 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; SoupURI *target_uri = NULL;
gs_unref_variant GVariant *metadata = 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; gs_unref_variant GVariant *ret_delta_superblock = NULL;
g_autofree char *delta_name = g_autofree char *delta_name =
_ostree_get_relative_static_delta_superblock_path (from_revision, to_revision); _ostree_get_relative_static_delta_superblock_path (from_revision, to_revision);
gs_unref_bytes GBytes *delta_superblock_data = NULL; g_autoptr(GBytes) delta_superblock_data = NULL;
gs_unref_bytes GBytes *delta_meta_data = NULL; g_autoptr(GBytes) delta_meta_data = NULL;
gs_unref_variant GVariant *delta_superblock = NULL; gs_unref_variant GVariant *delta_superblock = NULL;
SoupURI *target_uri = 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) if (pull_data->is_mirror && !refs_to_fetch && !configured_branches)
{ {
SoupURI *summary_uri = NULL; SoupURI *summary_uri = NULL;
gs_unref_bytes GBytes *bytes = NULL; g_autoptr(GBytes) bytes = NULL;
g_autofree char *ret_contents = NULL; g_autofree char *ret_contents = NULL;
summary_uri = suburi_new (pull_data->base_uri, "summary", NULL); summary_uri = suburi_new (pull_data->base_uri, "summary", NULL);

View File

@ -455,7 +455,7 @@ get_unpacked_unlinked_content (OstreeRepo *repo,
gboolean ret = FALSE; gboolean ret = FALSE;
g_autofree char *tmpname = g_strdup ("tmpostree-deltaobj-XXXXXX"); g_autofree char *tmpname = g_strdup ("tmpostree-deltaobj-XXXXXX");
gs_fd_close int fd = -1; 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(GInputStream) istream = NULL;
g_autoptr(GFileInfo) ret_finfo = NULL; g_autoptr(GFileInfo) ret_finfo = NULL;
g_autoptr(GOutputStream) out = NULL; g_autoptr(GOutputStream) out = NULL;
@ -506,8 +506,8 @@ try_content_bsdiff (OstreeRepo *repo,
gboolean ret = FALSE; gboolean ret = FALSE;
gs_unref_hashtable GHashTable *from_bsdiff = NULL; gs_unref_hashtable GHashTable *from_bsdiff = NULL;
gs_unref_hashtable GHashTable *to_bsdiff = NULL; gs_unref_hashtable GHashTable *to_bsdiff = NULL;
gs_unref_bytes GBytes *tmp_from = NULL; g_autoptr(GBytes) tmp_from = NULL;
gs_unref_bytes GBytes *tmp_to = NULL; g_autoptr(GBytes) tmp_to = NULL;
g_autoptr(GFileInfo) from_finfo = NULL; g_autoptr(GFileInfo) from_finfo = NULL;
g_autoptr(GFileInfo) to_finfo = NULL; g_autoptr(GFileInfo) to_finfo = NULL;
ContentBsdiff *ret_bsdiff = NULL; ContentBsdiff *ret_bsdiff = NULL;
@ -548,8 +548,8 @@ try_content_rollsum (OstreeRepo *repo,
gboolean ret = FALSE; gboolean ret = FALSE;
gs_unref_hashtable GHashTable *from_rollsum = NULL; gs_unref_hashtable GHashTable *from_rollsum = NULL;
gs_unref_hashtable GHashTable *to_rollsum = NULL; gs_unref_hashtable GHashTable *to_rollsum = NULL;
gs_unref_bytes GBytes *tmp_from = NULL; g_autoptr(GBytes) tmp_from = NULL;
gs_unref_bytes GBytes *tmp_to = NULL; g_autoptr(GBytes) tmp_to = NULL;
g_autoptr(GFileInfo) from_finfo = NULL; g_autoptr(GFileInfo) from_finfo = NULL;
g_autoptr(GFileInfo) to_finfo = NULL; g_autoptr(GFileInfo) to_finfo = NULL;
OstreeRollsumMatches *matches = NULL; OstreeRollsumMatches *matches = NULL;
@ -1301,8 +1301,8 @@ ostree_repo_static_delta_generate (OstreeRepo *self,
GBytes *operations_b; GBytes *operations_b;
g_autofree guchar *part_checksum = NULL; g_autofree guchar *part_checksum = NULL;
g_autoptr(GChecksum) checksum = NULL; g_autoptr(GChecksum) checksum = NULL;
gs_unref_bytes GBytes *objtype_checksum_array = NULL; g_autoptr(GBytes) objtype_checksum_array = NULL;
gs_unref_bytes GBytes *checksum_bytes = NULL; g_autoptr(GBytes) checksum_bytes = NULL;
g_autoptr(GFile) part_tempfile = NULL; g_autoptr(GFile) part_tempfile = NULL;
g_autoptr(GOutputStream) part_temp_outstream = NULL; g_autoptr(GOutputStream) part_temp_outstream = NULL;
g_autoptr(GInputStream) part_in = NULL; g_autoptr(GInputStream) part_in = NULL;

View File

@ -318,7 +318,7 @@ ostree_repo_static_delta_execute_offline (OstreeRepo *self,
{ {
GMappedFile *mfile = gs_file_map_noatime (part_path, cancellable, error); GMappedFile *mfile = gs_file_map_noatime (part_path, cancellable, error);
gs_unref_bytes GBytes *bytes = NULL; g_autoptr(GBytes) bytes = NULL;
if (!mfile) if (!mfile)
goto out; goto out;

View File

@ -319,8 +319,8 @@ _ostree_static_delta_part_execute (OstreeRepo *repo,
gboolean ret = FALSE; gboolean ret = FALSE;
gsize partlen; gsize partlen;
const guint8*partdata; const guint8*partdata;
gs_unref_bytes GBytes *part_payload_bytes = NULL; g_autoptr(GBytes) part_payload_bytes = NULL;
gs_unref_bytes GBytes *payload_data = NULL; g_autoptr(GBytes) payload_data = NULL;
gs_unref_variant GVariant *payload = NULL; gs_unref_variant GVariant *payload = NULL;
guint8 comptype; guint8 comptype;

View File

@ -2032,7 +2032,7 @@ ostree_repo_load_file (OstreeRepo *self,
{ {
guint32 mode; guint32 mode;
gs_unref_variant GVariant *metadata = NULL; gs_unref_variant GVariant *metadata = NULL;
gs_unref_bytes GBytes *bytes = NULL; g_autoptr(GBytes) bytes = NULL;
gs_fd_close int fd = -1; gs_fd_close int fd = -1;
bytes = ot_lgetxattrat (self->objects_dir_fd, loose_path_buf, 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(GFile) tmp_signature_file = NULL;
g_autoptr(GOutputStream) tmp_signature_output = NULL; g_autoptr(GOutputStream) tmp_signature_output = NULL;
gpgme_ctx_t context = 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_engine_info_t info;
gpgme_error_t err; gpgme_error_t err;
gpgme_key_t key = NULL; gpgme_key_t key = NULL;
@ -3248,8 +3248,8 @@ ostree_repo_sign_commit (OstreeRepo *self,
GError **error) GError **error)
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
gs_unref_bytes GBytes *commit_data = NULL; g_autoptr(GBytes) commit_data = NULL;
gs_unref_bytes GBytes *signature = NULL; g_autoptr(GBytes) signature = NULL;
gs_unref_variant GVariant *commit_variant = NULL; gs_unref_variant GVariant *commit_variant = NULL;
gs_unref_variant GVariant *old_metadata = NULL; gs_unref_variant GVariant *old_metadata = NULL;
gs_unref_variant GVariant *new_metadata = NULL; gs_unref_variant GVariant *new_metadata = NULL;
@ -3342,8 +3342,8 @@ ostree_repo_sign_delta (OstreeRepo *self,
GError **error) GError **error)
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
gs_unref_bytes GBytes *delta_data = NULL; g_autoptr(GBytes) delta_data = NULL;
gs_unref_bytes GBytes *signature_data = NULL; g_autoptr(GBytes) signature_data = NULL;
gs_unref_variant GVariant *commit_variant = NULL; gs_unref_variant GVariant *commit_variant = NULL;
g_autofree char *delta_path = NULL; g_autofree char *delta_path = NULL;
g_autoptr(GFile) delta_file = 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; gs_unref_variant GVariant *commit_variant = NULL;
g_autoptr(GFile) keyringdir_ref = NULL; g_autoptr(GFile) keyringdir_ref = NULL;
gs_unref_variant GVariant *metadata = 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; g_autofree char *commit_filename = NULL;
/* Create a temporary file for the commit */ /* Create a temporary file for the commit */

View File

@ -853,7 +853,7 @@ ostree_sysroot_write_origin_file (OstreeSysroot *sysroot,
g_autoptr(GFile) origin_parent = g_file_get_parent (origin_path); g_autoptr(GFile) origin_parent = g_file_get_parent (origin_path);
g_autofree char *contents = NULL; g_autofree char *contents = NULL;
gsize len; gsize len;
gs_unref_bytes GBytes *contents_bytes = NULL; g_autoptr(GBytes) contents_bytes = NULL;
contents = g_key_file_to_data (origin, &len, error); contents = g_key_file_to_data (origin, &len, error);
if (!contents) if (!contents)