diff --git a/src/libostree/ostree-bootconfig-parser.c b/src/libostree/ostree-bootconfig-parser.c index 5cad20fa..43f36caa 100644 --- a/src/libostree/ostree-bootconfig-parser.c +++ b/src/libostree/ostree-bootconfig-parser.c @@ -80,7 +80,7 @@ ostree_bootconfig_parser_parse_at (OstreeBootconfigParser *self, GError **error) { gboolean ret = FALSE; - gs_free char *contents = NULL; + g_autofree char *contents = NULL; char **lines = NULL; char **iter = NULL; diff --git a/src/libostree/ostree-bootloader-grub2.c b/src/libostree/ostree-bootloader-grub2.c index 1542b4e2..4e99d46d 100644 --- a/src/libostree/ostree-bootloader-grub2.c +++ b/src/libostree/ostree-bootloader-grub2.c @@ -82,7 +82,7 @@ _ostree_bootloader_grub2_query (OstreeBootloader *bootloader, { GFileInfo *file_info; const char *fname; - gs_free char *subdir_grub_cfg = NULL; + g_autofree char *subdir_grub_cfg = NULL; if (!gs_file_enumerator_iterate (direnum, &file_info, NULL, cancellable, error)) @@ -297,9 +297,9 @@ _ostree_bootloader_grub2_write_config (OstreeBootloader *bootloader, gs_unref_object GSSubprocessContext *procctx = NULL; gs_unref_object GSSubprocess *proc = NULL; gs_strfreev char **child_env = g_get_environ (); - gs_free char *bootversion_str = g_strdup_printf ("%u", (guint)bootversion); + g_autofree char *bootversion_str = g_strdup_printf ("%u", (guint)bootversion); gs_unref_object GFile *config_path_efi_dir = NULL; - gs_free char *grub2_mkconfig_chroot = NULL; + g_autofree char *grub2_mkconfig_chroot = NULL; if (ostree_sysroot_get_booted_deployment (self->sysroot) == NULL && g_file_has_parent (self->sysroot->path, NULL)) diff --git a/src/libostree/ostree-bootloader-syslinux.c b/src/libostree/ostree-bootloader-syslinux.c index 6c2b4417..71a18ecb 100644 --- a/src/libostree/ostree-bootloader-syslinux.c +++ b/src/libostree/ostree-bootloader-syslinux.c @@ -123,11 +123,11 @@ _ostree_bootloader_syslinux_write_config (OstreeBootloader *bootloader, gboolean ret = FALSE; OstreeBootloaderSyslinux *self = OSTREE_BOOTLOADER_SYSLINUX (bootloader); gs_unref_object GFile *new_config_path = NULL; - gs_free char *config_contents = NULL; - gs_free char *new_config_contents = NULL; + g_autofree char *config_contents = NULL; + g_autofree char *new_config_contents = NULL; gs_unref_ptrarray GPtrArray *new_lines = NULL; gs_unref_ptrarray GPtrArray *tmp_lines = NULL; - gs_free char *kernel_arg = NULL; + g_autofree char *kernel_arg = NULL; gboolean saw_default = FALSE; gboolean regenerate_default = FALSE; gboolean parsing_label = FALSE; diff --git a/src/libostree/ostree-bootloader-uboot.c b/src/libostree/ostree-bootloader-uboot.c index 84c5cddc..a64c66a2 100644 --- a/src/libostree/ostree-bootloader-uboot.c +++ b/src/libostree/ostree-bootloader-uboot.c @@ -109,8 +109,8 @@ _ostree_bootloader_uboot_write_config (OstreeBootloader *bootloader, { OstreeBootloaderUboot *self = OSTREE_BOOTLOADER_UBOOT (bootloader); gs_unref_object GFile *new_config_path = NULL; - gs_free char *config_contents = NULL; - gs_free char *new_config_contents = NULL; + g_autofree char *config_contents = NULL; + g_autofree char *new_config_contents = NULL; gs_unref_ptrarray GPtrArray *new_lines = NULL; /* This should follow the symbolic link to the current bootversion. */ diff --git a/src/libostree/ostree-core.c b/src/libostree/ostree-core.c index 077c666d..84a1809a 100644 --- a/src/libostree/ostree-core.c +++ b/src/libostree/ostree-core.c @@ -124,7 +124,7 @@ ostree_parse_refspec (const char *refspec, { gboolean ret = FALSE; GMatchInfo *match = NULL; - gs_free char *remote = NULL; + g_autofree char *remote = NULL; static gsize regex_initialized; static GRegex *regex; @@ -497,7 +497,7 @@ ostree_content_stream_parse (gboolean compressed, gs_unref_object GFileInfo *ret_file_info = NULL; gs_unref_variant GVariant *ret_xattrs = NULL; gs_unref_variant GVariant *file_header = NULL; - gs_free guchar *buf = NULL; + g_autofree guchar *buf = NULL; if (!g_input_stream_read_all (input, &archive_header_size, 4, &bytes_read, @@ -683,7 +683,7 @@ ostree_checksum_file_from_input (GFileInfo *file_info, GError **error) { gboolean ret = FALSE; - gs_free guchar *ret_csum = NULL; + g_autofree guchar *ret_csum = NULL; GChecksum *checksum = NULL; checksum = g_checksum_new (G_CHECKSUM_SHA256); @@ -747,7 +747,7 @@ ostree_checksum_file (GFile *f, gs_unref_object GFileInfo *file_info = NULL; gs_unref_object GInputStream *in = NULL; gs_unref_variant GVariant *xattrs = NULL; - gs_free guchar *ret_csum = NULL; + g_autofree guchar *ret_csum = NULL; if (g_cancellable_set_error_if_cancelled (cancellable, error)) return FALSE; @@ -920,7 +920,7 @@ _ostree_make_temporary_symlink_at (int tmp_dirfd, GError **error) { gboolean ret = FALSE; - gs_free char *tmpname = NULL; + g_autofree char *tmpname = NULL; guint i; const int max_attempts = 128; @@ -1493,7 +1493,7 @@ _ostree_get_relative_static_delta_part_path (const char *from, const char *to, guint i) { - gs_free char *partstr = g_strdup_printf ("%u", i); + g_autofree char *partstr = g_strdup_printf ("%u", i); return _ostree_get_relative_static_delta_path (from, to, partstr); } diff --git a/src/libostree/ostree-deployment.c b/src/libostree/ostree-deployment.c index c204f43d..85e8e4bc 100644 --- a/src/libostree/ostree-deployment.c +++ b/src/libostree/ostree-deployment.c @@ -150,7 +150,7 @@ ostree_deployment_clone (OstreeDeployment *self) if (self->origin) { - gs_free char *data = NULL; + g_autofree char *data = NULL; gsize len; gboolean success; diff --git a/src/libostree/ostree-diff.c b/src/libostree/ostree-diff.c index 150d3345..57e78e5c 100644 --- a/src/libostree/ostree-diff.c +++ b/src/libostree/ostree-diff.c @@ -35,8 +35,8 @@ get_file_checksum (OstreeDiffFlags flags, GError **error) { gboolean ret = FALSE; - gs_free char *ret_checksum = NULL; - gs_free guchar *csum = NULL; + g_autofree char *ret_checksum = NULL; + g_autofree guchar *csum = NULL; if (OSTREE_IS_REPO_FILE (f)) { @@ -129,8 +129,8 @@ diff_files (OstreeDiffFlags flags, GError **error) { gboolean ret = FALSE; - gs_free char *checksum_a = NULL; - gs_free char *checksum_b = NULL; + g_autofree char *checksum_a = NULL; + g_autofree char *checksum_b = NULL; OstreeDiffItem *ret_item = NULL; if (!get_file_checksum (flags, a, a_info, &checksum_a, cancellable, error)) @@ -412,7 +412,7 @@ print_diff_item (char prefix, { if (g_file_is_native (file)) { - gs_free char *relpath = g_file_get_relative_path (base, file); + g_autofree char *relpath = g_file_get_relative_path (base, file); g_print ("%c %s\n", prefix, relpath); } else diff --git a/src/libostree/ostree-fetcher.c b/src/libostree/ostree-fetcher.c index 2aa4178e..9747925e 100644 --- a/src/libostree/ostree-fetcher.c +++ b/src/libostree/ostree-fetcher.c @@ -404,7 +404,7 @@ on_stream_read (GObject *object, if (bytes_read > pending->max_size || (bytes_read + pending->current_size) > pending->max_size) { - gs_free char *uristr = soup_uri_to_string (pending->uri, FALSE); + g_autofree char *uristr = soup_uri_to_string (pending->uri, FALSE); g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "URI %s exceeded maximum size of %" G_GUINT64_FORMAT " bytes", uristr, @@ -576,8 +576,8 @@ ostree_fetcher_request_uri_internal (OstreeFetcher *self, } else { - gs_free char *uristring = soup_uri_to_string (uri, FALSE); - gs_free char *tmpfile = NULL; + g_autofree char *uristring = soup_uri_to_string (uri, FALSE); + g_autofree char *tmpfile = NULL; struct stat stbuf; gboolean exists; @@ -746,7 +746,7 @@ _ostree_fetcher_request_uri_to_membuf (OstreeFetcher *fetcher, { gboolean ret = FALSE; const guint8 nulchar = 0; - gs_free char *ret_contents = NULL; + g_autofree char *ret_contents = NULL; gs_unref_object GMemoryOutputStream *buf = NULL; FetchUriSyncData data; g_assert (error != NULL); diff --git a/src/libostree/ostree-gpg-verify-result.c b/src/libostree/ostree-gpg-verify-result.c index 6a2d869c..1e84cf0c 100644 --- a/src/libostree/ostree-gpg-verify-result.c +++ b/src/libostree/ostree-gpg-verify-result.c @@ -238,7 +238,7 @@ ostree_gpg_verify_result_lookup (OstreeGpgVerifyResult *result, const gchar *key_id, guint *out_signature_index) { - gs_free char *key_id_upper = NULL; + g_autofree char *key_id_upper = NULL; gpgme_signature_t signature; guint signature_index; gboolean ret = FALSE; diff --git a/src/libostree/ostree-kernel-args.c b/src/libostree/ostree-kernel-args.c index e4dfec06..101ae640 100644 --- a/src/libostree/ostree-kernel-args.c +++ b/src/libostree/ostree-kernel-args.c @@ -164,7 +164,7 @@ _ostree_kernel_args_append_proc_cmdline (OstreeKernelArgs *kargs, GError **error) { gs_unref_object GFile *proc_cmdline_path = g_file_new_for_path ("/proc/cmdline"); - gs_free char *proc_cmdline = NULL; + g_autofree char *proc_cmdline = NULL; gsize proc_cmdline_len = 0; gs_strfreev char **proc_cmdline_args = NULL; diff --git a/src/libostree/ostree-metalink.c b/src/libostree/ostree-metalink.c index c92453e3..c2603a4c 100644 --- a/src/libostree/ostree-metalink.c +++ b/src/libostree/ostree-metalink.c @@ -328,7 +328,7 @@ metalink_parser_text (GMarkupParseContext *context, break; case OSTREE_METALINK_STATE_SIZE: { - gs_free char *duped = g_strndup (text, text_len); + g_autofree char *duped = g_strndup (text, text_len); self->size = g_ascii_strtoull (duped, NULL, 10); } break; @@ -356,7 +356,7 @@ metalink_parser_text (GMarkupParseContext *context, break; case OSTREE_METALINK_STATE_URL: { - gs_free char *uri_text = g_strndup (text, text_len); + g_autofree char *uri_text = g_strndup (text, text_len); SoupURI *uri = soup_uri_new (uri_text); if (uri != NULL) g_ptr_array_add (self->urls, uri); @@ -433,7 +433,7 @@ on_fetched_url (GObject *src, struct stat stbuf; int parent_dfd = _ostree_fetcher_get_dfd (self->metalink->fetcher); gs_unref_object GInputStream *instream = NULL; - gs_free char *result = NULL; + g_autofree char *result = NULL; GChecksum *checksum = NULL; result = _ostree_fetcher_request_uri_with_partial_finish ((OstreeFetcher*)src, res, &local_error); diff --git a/src/libostree/ostree-mutable-tree.c b/src/libostree/ostree-mutable-tree.c index 17bcdc9a..20cd2b26 100644 --- a/src/libostree/ostree-mutable-tree.c +++ b/src/libostree/ostree-mutable-tree.c @@ -218,7 +218,7 @@ ostree_mutable_tree_lookup (OstreeMutableTree *self, { gboolean ret = FALSE; gs_unref_object OstreeMutableTree *ret_subdir = NULL; - gs_free char *ret_file_checksum = NULL; + g_autofree char *ret_file_checksum = NULL; ret_subdir = ot_gobject_refz (g_hash_table_lookup (self->subdirs, name)); if (!ret_subdir) diff --git a/src/libostree/ostree-repo-checkout.c b/src/libostree/ostree-repo-checkout.c index b487b549..c46cabb9 100644 --- a/src/libostree/ostree-repo-checkout.c +++ b/src/libostree/ostree-repo-checkout.c @@ -41,7 +41,7 @@ checkout_object_for_uncompressed_cache (OstreeRepo *self, GError **error) { gboolean ret = FALSE; - gs_free char *temp_filename = NULL; + g_autofree char *temp_filename = NULL; gs_unref_object GOutputStream *temp_out = NULL; int fd; int res; @@ -266,7 +266,7 @@ checkout_file_unioning_from_input_at (OstreeRepo *repo, GError **error) { gboolean ret = FALSE; - gs_free char *temp_filename = NULL; + g_autofree char *temp_filename = NULL; if (g_file_info_get_file_type (file_info) == G_FILE_TYPE_SYMBOLIC_LINK) { @@ -865,7 +865,7 @@ ostree_repo_checkout_gc (OstreeRepo *self, { gs_unref_object GFile *objdir = NULL; gs_unref_object GFileEnumerator *enumerator = NULL; - gs_free char *objdir_name = NULL; + g_autofree char *objdir_name = NULL; objdir_name = g_strdup_printf ("%02x", GPOINTER_TO_UINT (key)); objdir = g_file_get_child (self->uncompressed_objects_dir, objdir_name); diff --git a/src/libostree/ostree-repo-commit.c b/src/libostree/ostree-repo-commit.c index c5ffa5eb..51d0cac9 100644 --- a/src/libostree/ostree-repo-commit.c +++ b/src/libostree/ostree-repo-commit.c @@ -458,7 +458,7 @@ _ostree_repo_open_trusted_content_bare (OstreeRepo *self, GError **error) { gboolean ret = FALSE; - gs_free char *temp_filename = NULL; + g_autofree char *temp_filename = NULL; gs_unref_object GOutputStream *ret_stream = NULL; gboolean have_obj; char loose_objpath[_OSTREE_LOOSE_PATH_MAX]; @@ -536,9 +536,9 @@ write_object (OstreeRepo *self, const char *actual_checksum; gboolean do_commit; OstreeRepoMode repo_mode; - gs_free char *temp_filename = NULL; + g_autofree char *temp_filename = NULL; gs_unref_object GFile *stored_path = NULL; - gs_free guchar *ret_csum = NULL; + g_autofree guchar *ret_csum = NULL; gs_unref_object OstreeChecksumInputStream *checksum_input = NULL; gs_unref_object GInputStream *file_input = NULL; gs_unref_object GFileInfo *file_info = NULL; @@ -775,9 +775,9 @@ write_object (OstreeRepo *self, { if (G_UNLIKELY (file_object_length > OSTREE_MAX_METADATA_WARN_SIZE)) { - gs_free char *metasize = g_format_size (file_object_length); - gs_free char *warnsize = g_format_size (OSTREE_MAX_METADATA_WARN_SIZE); - gs_free char *maxsize = g_format_size (OSTREE_MAX_METADATA_SIZE); + g_autofree char *metasize = g_format_size (file_object_length); + g_autofree char *warnsize = g_format_size (OSTREE_MAX_METADATA_WARN_SIZE); + g_autofree char *maxsize = g_format_size (OSTREE_MAX_METADATA_SIZE); g_warning ("metadata object %s is %s, which is larger than the warning threshold of %s." \ " The hard limit on metadata size is %s. Put large content in the tree itself, not in metadata.", actual_checksum, @@ -1450,8 +1450,8 @@ ostree_repo_write_metadata (OstreeRepo *self, if (G_UNLIKELY (g_variant_get_size (normalized) > OSTREE_MAX_METADATA_SIZE)) { - gs_free char *input_bytes = g_format_size (g_variant_get_size (normalized)); - gs_free char *max_bytes = g_format_size (OSTREE_MAX_METADATA_SIZE); + g_autofree char *input_bytes = g_format_size (g_variant_get_size (normalized)); + g_autofree char *max_bytes = g_format_size (OSTREE_MAX_METADATA_SIZE); g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Metadata object of type '%s' is %s; maximum metadata size is %s", ostree_object_type_to_string (objtype), @@ -1852,10 +1852,10 @@ ostree_repo_write_commit (OstreeRepo *self, GError **error) { gboolean ret = FALSE; - gs_free char *ret_commit = NULL; + g_autofree char *ret_commit = NULL; gs_unref_variant GVariant *commit = NULL; gs_unref_variant GVariant *new_metadata = NULL; - gs_free guchar *commit_csum = NULL; + g_autofree guchar *commit_csum = NULL; GDateTime *now = NULL; OstreeRepoFile *repo_root = OSTREE_REPO_FILE (root); @@ -2213,7 +2213,7 @@ get_modified_xattrs (OstreeRepo *self, if (modifier && modifier->sepolicy) { - gs_free char *label = NULL; + g_autofree char *label = NULL; if (!ostree_sepolicy_get_label (modifier->sepolicy, relpath, g_file_info_get_attribute_uint32 (file_info, "unix::mode"), @@ -2279,7 +2279,7 @@ write_directory_content_to_mtree_internal (OstreeRepo *self, gs_unref_object GFile *child = NULL; gs_unref_object GFileInfo *modified_info = NULL; gs_unref_object OstreeMutableTree *child_mtree = NULL; - gs_free char *child_relpath = NULL; + g_autofree char *child_relpath = NULL; const char *name; GFileType file_type; OstreeRepoCommitFilterResult filter_result; @@ -2359,8 +2359,8 @@ write_directory_content_to_mtree_internal (OstreeRepo *self, gs_unref_object GInputStream *file_input = NULL; gs_unref_variant GVariant *xattrs = NULL; gs_unref_object GInputStream *file_object_input = NULL; - gs_free guchar *child_file_csum = NULL; - gs_free char *tmp_checksum = NULL; + g_autofree guchar *child_file_csum = NULL; + g_autofree char *tmp_checksum = NULL; loose_checksum = devino_cache_lookup (self, g_file_info_get_attribute_uint32 (child_info, "unix::device"), @@ -2466,9 +2466,9 @@ write_directory_to_mtree_internal (OstreeRepo *self, { gs_unref_object GFileInfo *modified_info = NULL; gs_unref_variant GVariant *xattrs = NULL; - gs_free guchar *child_file_csum = NULL; - gs_free char *tmp_checksum = NULL; - gs_free char *relpath = NULL; + g_autofree guchar *child_file_csum = NULL; + g_autofree char *tmp_checksum = NULL; + g_autofree char *relpath = NULL; child_info = g_file_query_info (dir, OSTREE_GIO_FAST_QUERYINFO, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, @@ -2548,9 +2548,9 @@ write_dfd_iter_to_mtree_internal (OstreeRepo *self, gs_unref_object GFileInfo *child_info = NULL; gs_unref_object GFileInfo *modified_info = NULL; gs_unref_variant GVariant *xattrs = NULL; - gs_free guchar *child_file_csum = NULL; - gs_free char *tmp_checksum = NULL; - gs_free char *relpath = NULL; + g_autofree guchar *child_file_csum = NULL; + g_autofree char *tmp_checksum = NULL; + g_autofree char *relpath = NULL; OstreeRepoCommitFilterResult filter_result; struct stat dir_stbuf; @@ -2759,7 +2759,7 @@ ostree_repo_write_mtree (OstreeRepo *self, gs_unref_hashtable GHashTable *dir_metadata_checksums = NULL; gs_unref_hashtable GHashTable *dir_contents_checksums = NULL; gs_unref_variant GVariant *serialized_tree = NULL; - gs_free guchar *contents_csum = NULL; + g_autofree guchar *contents_csum = NULL; char contents_checksum_buf[65]; dir_contents_checksums = g_hash_table_new_full (g_str_hash, g_str_equal, diff --git a/src/libostree/ostree-repo-file.c b/src/libostree/ostree-repo-file.c index f3215c62..47df3fe1 100644 --- a/src/libostree/ostree-repo-file.c +++ b/src/libostree/ostree-repo-file.c @@ -218,7 +218,7 @@ do_resolve_nonroot (OstreeRepoFile *self, gs_unref_variant GVariant *tree_metadata = NULL; gs_unref_variant GVariant *contents_csum_v = NULL; gs_unref_variant GVariant *metadata_csum_v = NULL; - gs_free char *tmp_checksum = NULL; + g_autofree char *tmp_checksum = NULL; if (!ostree_repo_file_ensure_resolved (self->parent, error)) goto out; diff --git a/src/libostree/ostree-repo-libarchive.c b/src/libostree/ostree-repo-libarchive.c index 613b493e..d8001e94 100644 --- a/src/libostree/ostree-repo-libarchive.c +++ b/src/libostree/ostree-repo-libarchive.c @@ -128,10 +128,10 @@ write_libarchive_entry_to_mtree (OstreeRepo *self, gs_unref_object OstreeMutableTree *subdir = NULL; gs_unref_object OstreeMutableTree *parent = NULL; gs_unref_object OstreeMutableTree *hardlink_source_parent = NULL; - gs_free char *hardlink_source_checksum = NULL; + g_autofree char *hardlink_source_checksum = NULL; gs_unref_object OstreeMutableTree *hardlink_source_subdir = NULL; - gs_free guchar *tmp_csum = NULL; - gs_free char *tmp_checksum = NULL; + g_autofree guchar *tmp_csum = NULL; + g_autofree char *tmp_checksum = NULL; pathname = archive_entry_pathname (entry); @@ -295,7 +295,7 @@ ostree_repo_write_archive_to_mtree (OstreeRepo *self, struct archive_entry *entry; int r; gs_unref_object GFileInfo *tmp_dir_info = NULL; - gs_free guchar *tmp_csum = NULL; + g_autofree guchar *tmp_csum = NULL; a = archive_read_new (); #ifdef HAVE_ARCHIVE_READ_SUPPORT_FILTER_ALL diff --git a/src/libostree/ostree-repo-prune.c b/src/libostree/ostree-repo-prune.c index 1e61dbc0..854627ae 100644 --- a/src/libostree/ostree-repo-prune.c +++ b/src/libostree/ostree-repo-prune.c @@ -233,8 +233,8 @@ ostree_repo_prune (OstreeRepo *self, const char *dash = strchr (deltaname, '-'); const char *to = NULL; gboolean have_commit; - gs_free char *from = NULL; - gs_free char *deltadir = NULL; + g_autofree char *from = NULL; + g_autofree char *deltadir = NULL; if (!dash) { diff --git a/src/libostree/ostree-repo-pull.c b/src/libostree/ostree-repo-pull.c index db91d1ec..74c32dbc 100644 --- a/src/libostree/ostree-repo-pull.c +++ b/src/libostree/ostree-repo-pull.c @@ -219,8 +219,8 @@ update_progress (gpointer user_data) if (pull_data->fetching_sync_uri) { - gs_free char *uri_string = soup_uri_to_string (pull_data->fetching_sync_uri, TRUE); - gs_free char *status_string = g_strconcat ("Requesting ", uri_string, NULL); + g_autofree char *uri_string = soup_uri_to_string (pull_data->fetching_sync_uri, TRUE); + g_autofree char *status_string = g_strconcat ("Requesting ", uri_string, NULL); ostree_async_progress_set_status (pull_data->progress, status_string); } else @@ -324,7 +324,7 @@ fetch_uri_contents_utf8_sync (OtPullData *pull_data, { gboolean ret = FALSE; gs_unref_bytes GBytes *bytes = NULL; - gs_free char *ret_contents = NULL; + g_autofree char *ret_contents = NULL; gsize len; if (!fetch_uri_contents_membuf_sync (pull_data, uri, TRUE, FALSE, @@ -395,7 +395,7 @@ scan_dirtree_object (OtPullData *pull_data, const char *filename; gboolean file_is_stored; gs_unref_variant GVariant *csum = NULL; - gs_free char *file_checksum = NULL; + g_autofree char *file_checksum = NULL; g_variant_get_child (files_variant, i, "(&s@ay)", &filename, &csum); @@ -427,7 +427,7 @@ scan_dirtree_object (OtPullData *pull_data, { const char *subpath = NULL; const char *nextslash = NULL; - gs_free char *dir_data = NULL; + g_autofree char *dir_data = NULL; g_assert (pull_data->dir[0] == '/'); // assert it starts with / like "/usr/share/rpm" subpath = pull_data->dir + 1; // refers to name minus / like "usr/share/rpm" @@ -484,7 +484,7 @@ fetch_ref_contents (OtPullData *pull_data, GError **error) { gboolean ret = FALSE; - gs_free char *ret_contents = NULL; + g_autofree char *ret_contents = NULL; SoupURI *target_uri = NULL; target_uri = suburi_new (pull_data->base_uri, "refs", "heads", ref, NULL); @@ -555,8 +555,8 @@ content_fetch_on_write_complete (GObject *object, GError **error = &local_error; OstreeObjectType objtype; const char *expected_checksum; - gs_free guchar *csum = NULL; - gs_free char *checksum = NULL; + g_autofree guchar *csum = NULL; + g_autofree char *checksum = NULL; if (!ostree_repo_write_content_finish ((OstreeRepo*)object, result, &csum, error)) @@ -600,7 +600,7 @@ content_fetch_on_complete (GObject *object, gs_unref_variant GVariant *xattrs = NULL; gs_unref_object GInputStream *file_in = NULL; gs_unref_object GInputStream *object_input = NULL; - gs_free char *temp_path = NULL; + g_autofree char *temp_path = NULL; const char *checksum; OstreeObjectType objtype; @@ -677,9 +677,9 @@ on_metadata_written (GObject *object, GError **error = &local_error; const char *expected_checksum; OstreeObjectType objtype; - gs_free char *checksum = NULL; - gs_free guchar *csum = NULL; - gs_free char *stringified_object = NULL; + g_autofree char *checksum = NULL; + g_autofree guchar *csum = NULL; + g_autofree char *stringified_object = NULL; if (!ostree_repo_write_metadata_finish ((OstreeRepo*)object, result, &csum, error)) @@ -721,7 +721,7 @@ meta_fetch_on_complete (GObject *object, FetchObjectData *fetch_data = user_data; OtPullData *pull_data = fetch_data->pull_data; gs_unref_variant GVariant *metadata = NULL; - gs_free char *temp_path = NULL; + g_autofree char *temp_path = NULL; const char *checksum; OstreeObjectType objtype; GError *local_error = NULL; @@ -854,10 +854,10 @@ static_deltapart_fetch_on_complete (GObject *object, FetchStaticDeltaData *fetch_data = user_data; OtPullData *pull_data = fetch_data->pull_data; gs_unref_variant GVariant *metadata = NULL; - gs_free char *temp_path = NULL; + g_autofree char *temp_path = NULL; gs_unref_object GInputStream *in = NULL; - gs_free char *actual_checksum = NULL; - gs_free guint8 *csum = NULL; + g_autofree char *actual_checksum = NULL; + g_autofree guint8 *csum = NULL; GError *local_error = NULL; GError **error = &local_error; gs_fd_close int fd = -1; @@ -1080,7 +1080,7 @@ scan_one_metadata_object_c (OtPullData *pull_data, { gboolean ret = FALSE; gs_unref_variant GVariant *object = NULL; - gs_free char *tmp_checksum = NULL; + g_autofree char *tmp_checksum = NULL; gboolean is_requested; gboolean is_stored; @@ -1187,7 +1187,7 @@ enqueue_one_object_request (OtPullData *pull_data, SoupURI *obj_uri = NULL; gboolean is_meta; FetchObjectData *fetch_data; - gs_free char *objpath = NULL; + g_autofree char *objpath = NULL; guint64 *expected_max_size_p; guint64 expected_max_size; @@ -1250,7 +1250,7 @@ repo_get_remote_option_inherit (OstreeRepo *self, GError **error) { OstreeRepo *parent = ostree_repo_get_parent (self); - gs_free char *value = NULL; + g_autofree char *value = NULL; gboolean ret = FALSE; if (!_ostree_repo_get_remote_option (self, remote_name, option_name, NULL, &value, error)) @@ -1278,7 +1278,7 @@ load_remote_repo_config (OtPullData *pull_data, GError **error) { gboolean ret = FALSE; - gs_free char *contents = NULL; + g_autofree char *contents = NULL; GKeyFile *ret_keyfile = NULL; SoupURI *target_uri = NULL; @@ -1310,7 +1310,7 @@ fetch_metadata_to_verify_delta_superblock (OtPullData *pull_data, GError **error) { gboolean ret = FALSE; - gs_free 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; SoupURI *target_uri = NULL; gs_unref_variant GVariant *metadata = NULL; @@ -1349,7 +1349,7 @@ request_static_delta_superblock_sync (OtPullData *pull_data, { gboolean ret = FALSE; gs_unref_variant GVariant *ret_delta_superblock = NULL; - gs_free char *delta_name = + 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; @@ -1393,7 +1393,7 @@ process_one_static_delta_fallback (OtPullData *pull_data, { gboolean ret = FALSE; gs_unref_variant GVariant *csum_v = NULL; - gs_free char *checksum = NULL; + g_autofree char *checksum = NULL; guint8 objtype_y; OstreeObjectType objtype; gboolean is_stored; @@ -1479,7 +1479,7 @@ process_one_static_delta (OtPullData *pull_data, /* Write the to-commit object */ { gs_unref_variant GVariant *to_csum_v = NULL; - gs_free char *to_checksum = NULL; + g_autofree char *to_checksum = NULL; gs_unref_variant GVariant *to_commit = NULL; gboolean have_to_commit; @@ -1519,7 +1519,7 @@ process_one_static_delta (OtPullData *pull_data, gs_unref_variant GVariant *header = NULL; gboolean have_all = FALSE; SoupURI *target_uri = NULL; - gs_free char *deltapart_path = NULL; + g_autofree char *deltapart_path = NULL; FetchStaticDeltaData *fetch_data; gs_unref_variant GVariant *csum_v = NULL; gs_unref_variant GVariant *objects = NULL; @@ -1633,13 +1633,13 @@ ostree_repo_pull_with_options (OstreeRepo *self, gpointer key, value; gboolean tls_permissive = FALSE; OstreeFetcherConfigFlags fetcher_flags = 0; - gs_free char *remote_key = NULL; - gs_free char *path = NULL; - gs_free char *baseurl = NULL; - gs_free char *metalink_url_str = NULL; + g_autofree char *remote_key = NULL; + g_autofree char *path = NULL; + g_autofree char *baseurl = NULL; + g_autofree char *metalink_url_str = NULL; gs_unref_hashtable GHashTable *requested_refs_to_fetch = NULL; gs_unref_hashtable GHashTable *commits_to_fetch = NULL; - gs_free char *remote_mode_str = NULL; + g_autofree char *remote_mode_str = NULL; gs_unref_object OstreeMetalink *metalink = NULL; OtPullData pull_data_real = { 0, }; OtPullData *pull_data = &pull_data_real; @@ -1728,8 +1728,8 @@ ostree_repo_pull_with_options (OstreeRepo *self, commits_to_fetch = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); { - gs_free char *tls_client_cert_path = NULL; - gs_free char *tls_client_key_path = NULL; + g_autofree char *tls_client_cert_path = NULL; + g_autofree char *tls_client_key_path = NULL; if (!_ostree_repo_get_remote_option (self, remote_name_or_baseurl, "tls-client-cert-path", @@ -1764,7 +1764,7 @@ ostree_repo_pull_with_options (OstreeRepo *self, } { - gs_free char *tls_ca_path = NULL; + g_autofree char *tls_ca_path = NULL; gs_unref_object GTlsDatabase *db = NULL; if (!_ostree_repo_get_remote_option (self, @@ -1783,7 +1783,7 @@ ostree_repo_pull_with_options (OstreeRepo *self, } { - gs_free char *http_proxy = NULL; + g_autofree char *http_proxy = NULL; if (!_ostree_repo_get_remote_option (self, remote_name_or_baseurl, "proxy", @@ -1826,7 +1826,7 @@ ostree_repo_pull_with_options (OstreeRepo *self, } else { - gs_free char *metalink_data = NULL; + g_autofree char *metalink_data = NULL; SoupURI *metalink_uri = soup_uri_new (metalink_url_str); SoupURI *target_uri = NULL; gs_fd_close int fd = -1; @@ -1852,7 +1852,7 @@ ostree_repo_pull_with_options (OstreeRepo *self, goto out; { - gs_free char *repo_base = g_path_get_dirname (soup_uri_get_path (target_uri)); + g_autofree char *repo_base = g_path_get_dirname (soup_uri_get_path (target_uri)); pull_data->base_uri = soup_uri_copy (target_uri); soup_uri_set_path (pull_data->base_uri, repo_base); } @@ -1908,7 +1908,7 @@ ostree_repo_pull_with_options (OstreeRepo *self, { SoupURI *summary_uri = NULL; gs_unref_bytes GBytes *bytes = NULL; - gs_free char *ret_contents = NULL; + g_autofree char *ret_contents = NULL; summary_uri = suburi_new (pull_data->base_uri, "summary", NULL); if (!fetch_uri_contents_membuf_sync (pull_data, summary_uri, FALSE, TRUE, @@ -2044,7 +2044,7 @@ ostree_repo_pull_with_options (OstreeRepo *self, g_hash_table_iter_init (&hash_iter, requested_refs_to_fetch); while (g_hash_table_iter_next (&hash_iter, &key, &value)) { - gs_free char *from_revision = NULL; + g_autofree char *from_revision = NULL; const char *ref = key; const char *to_revision = value; GVariant *delta_superblock = NULL; @@ -2109,8 +2109,8 @@ ostree_repo_pull_with_options (OstreeRepo *self, { const char *ref = key; const char *checksum = value; - gs_free char *remote_ref = NULL; - gs_free char *original_rev = NULL; + g_autofree char *remote_ref = NULL; + g_autofree char *original_rev = NULL; if (pull_data->remote_name) remote_ref = g_strdup_printf ("%s/%s", pull_data->remote_name, ref); diff --git a/src/libostree/ostree-repo-refs.c b/src/libostree/ostree-repo-refs.c index ee6db8ac..9c6dbe3f 100644 --- a/src/libostree/ostree-repo-refs.c +++ b/src/libostree/ostree-repo-refs.c @@ -176,7 +176,7 @@ resolve_refspec_fallback (OstreeRepo *self, GError **error) { gboolean ret = FALSE; - gs_free char *ret_rev = NULL; + g_autofree char *ret_rev = NULL; if (self->parent_repo) { @@ -211,7 +211,7 @@ resolve_refspec (OstreeRepo *self, gboolean ret = FALSE; __attribute__((unused)) GCancellable *cancellable = NULL; GError *temp_error = NULL; - gs_free char *ret_rev = NULL; + g_autofree char *ret_rev = NULL; gs_unref_object GFile *child = NULL; g_return_val_if_fail (ref != NULL, FALSE); @@ -294,7 +294,7 @@ ostree_repo_resolve_partial_checksum (OstreeRepo *self, static const char hexchars[] = "0123456789abcdef"; gsize off; gs_unref_hashtable GHashTable *ref_list = NULL; - gs_free char *ret_rev = NULL; + g_autofree char *ret_rev = NULL; guint length; const char *checksum = NULL; OstreeObjectType objtype; @@ -370,7 +370,7 @@ ostree_repo_resolve_rev (OstreeRepo *self, GError **error) { gboolean ret = FALSE; - gs_free char *ret_rev = NULL; + g_autofree char *ret_rev = NULL; g_return_val_if_fail (refspec != NULL, FALSE); @@ -389,8 +389,8 @@ ostree_repo_resolve_rev (OstreeRepo *self, if (g_str_has_suffix (refspec, "^")) { - gs_free char *parent_refspec = NULL; - gs_free char *parent_rev = NULL; + g_autofree char *parent_refspec = NULL; + g_autofree char *parent_rev = NULL; gs_unref_variant GVariant *commit = NULL; parent_refspec = g_strdup (refspec); @@ -412,8 +412,8 @@ ostree_repo_resolve_rev (OstreeRepo *self, } else { - gs_free char *remote = NULL; - gs_free char *ref = NULL; + g_autofree char *remote = NULL; + g_autofree char *ref = NULL; if (!ostree_parse_refspec (refspec, &remote, &ref, error)) goto out; @@ -498,8 +498,8 @@ ostree_repo_list_refs (OstreeRepo *self, { gboolean ret = FALSE; gs_unref_hashtable GHashTable *ret_all_refs = NULL; - gs_free char *remote = NULL; - gs_free char *ref_prefix = NULL; + g_autofree char *remote = NULL; + g_autofree char *ref_prefix = NULL; ret_all_refs = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); @@ -651,8 +651,8 @@ _ostree_repo_update_refs (OstreeRepo *self, { const char *refspec = key; const char *rev = value; - gs_free char *remote = NULL; - gs_free char *ref = NULL; + g_autofree char *remote = NULL; + g_autofree char *ref = NULL; if (!ostree_parse_refspec (refspec, &remote, &ref, error)) goto out; diff --git a/src/libostree/ostree-repo-static-delta-compilation.c b/src/libostree/ostree-repo-static-delta-compilation.c index 0563e861..f89311d9 100644 --- a/src/libostree/ostree-repo-static-delta-compilation.c +++ b/src/libostree/ostree-repo-static-delta-compilation.c @@ -453,7 +453,7 @@ get_unpacked_unlinked_content (OstreeRepo *repo, GError **error) { gboolean ret = FALSE; - gs_free char *tmpname = g_strdup ("tmpostree-deltaobj-XXXXXX"); + g_autofree char *tmpname = g_strdup ("tmpostree-deltaobj-XXXXXX"); gs_fd_close int fd = -1; gs_unref_bytes GBytes *ret_content = NULL; gs_unref_object GInputStream *istream = NULL; @@ -1094,7 +1094,7 @@ generate_delta_lowlatency (OstreeRepo *repo, if (fallback) { - gs_free char *size = g_format_size (uncompressed_size); + g_autofree char *size = g_format_size (uncompressed_size); if (opts & DELTAOPT_FLAG_VERBOSE) g_printerr ("fallback for %s (%s)\n", checksum, size); @@ -1252,7 +1252,7 @@ ostree_repo_static_delta_generate (OstreeRepo *self, gs_unref_ptrarray GPtrArray *part_tempfiles = NULL; gs_unref_variant GVariant *delta_descriptor = NULL; gs_unref_variant GVariant *to_commit = NULL; - gs_free char *descriptor_relpath = NULL; + g_autofree char *descriptor_relpath = NULL; gs_unref_object GFile *descriptor_path = NULL; gs_unref_object GFile *descriptor_dir = NULL; gs_unref_variant GVariant *tmp_metadata = NULL; @@ -1299,7 +1299,7 @@ ostree_repo_static_delta_generate (OstreeRepo *self, OstreeStaticDeltaPartBuilder *part_builder = builder.parts->pdata[i]; GBytes *payload_b; GBytes *operations_b; - gs_free guchar *part_checksum = NULL; + g_autofree guchar *part_checksum = NULL; gs_free_checksum GChecksum *checksum = NULL; gs_unref_bytes GBytes *objtype_checksum_array = NULL; gs_unref_bytes GBytes *checksum_bytes = NULL; @@ -1400,7 +1400,7 @@ ostree_repo_static_delta_generate (OstreeRepo *self, for (i = 0; i < builder.parts->len; i++) { GFile *tempfile = part_tempfiles->pdata[i]; - gs_free char *part_relpath = _ostree_get_relative_static_delta_part_path (from, to, i); + g_autofree char *part_relpath = _ostree_get_relative_static_delta_part_path (from, to, i); gs_unref_object GFile *part_path = g_file_resolve_relative_path (self->repodir, part_relpath); if (!gs_file_rename (tempfile, part_path, cancellable, error)) diff --git a/src/libostree/ostree-repo-static-delta-core.c b/src/libostree/ostree-repo-static-delta-core.c index 38fcc43d..988b7042 100644 --- a/src/libostree/ostree-repo-static-delta-core.c +++ b/src/libostree/ostree-repo-static-delta-core.c @@ -127,7 +127,7 @@ ostree_repo_list_static_delta_names (OstreeRepo *self, if (g_file_query_exists (meta_path, NULL)) { - gs_free char *buf = g_strconcat (name1, name2, NULL); + g_autofree char *buf = g_strconcat (name1, name2, NULL); GString *out = g_string_new (""); char checksum[65]; guchar csum[32]; @@ -238,7 +238,7 @@ ostree_repo_static_delta_execute_offline (OstreeRepo *self, /* Write the to-commit object */ { gs_unref_variant GVariant *to_csum_v = NULL; - gs_free char *to_checksum = NULL; + g_autofree char *to_checksum = NULL; gs_unref_variant GVariant *to_commit = NULL; gboolean have_to_commit; @@ -309,7 +309,7 @@ ostree_repo_static_delta_execute_offline (OstreeRepo *self, if (!skip_validation) { - gs_free char *expected_checksum = ostree_checksum_from_bytes (csum); + g_autofree char *expected_checksum = ostree_checksum_from_bytes (csum); if (!_ostree_static_delta_part_validate (self, part_path, i, expected_checksum, cancellable, error)) diff --git a/src/libostree/ostree-repo-static-delta-processing.c b/src/libostree/ostree-repo-static-delta-processing.c index 79c0a0eb..b82593b9 100644 --- a/src/libostree/ostree-repo-static-delta-processing.c +++ b/src/libostree/ostree-repo-static-delta-processing.c @@ -158,8 +158,8 @@ _ostree_static_delta_part_validate (OstreeRepo *repo, { gboolean ret = FALSE; gs_unref_object GInputStream *tmp_in = NULL; - gs_free guchar *actual_checksum_bytes = NULL; - gs_free gchar *actual_checksum = NULL; + g_autofree guchar *actual_checksum_bytes = NULL; + g_autofree char *actual_checksum = NULL; tmp_in = (GInputStream*)g_file_read (part_path, cancellable, error); if (!tmp_in) @@ -525,7 +525,7 @@ dispatch_bspatch (OstreeRepo *repo, guint64 offset, length; gs_unref_object GInputStream *in_stream = NULL; g_autoptr(GMappedFile) input_mfile = NULL; - gs_free guchar *buf = NULL; + g_autofree guchar *buf = NULL; struct bspatch_stream stream; struct bzpatch_opaque_s opaque; gsize bytes_written; @@ -651,7 +651,7 @@ dispatch_open_splice_and_close (OstreeRepo *repo, if (S_ISLNK (state->mode)) { - gs_free char *nulterminated_target = + g_autofree char *nulterminated_target = g_strndup ((char*)state->payload_data + content_offset, state->content_size); g_file_info_set_symlink_target (finfo, nulterminated_target); } diff --git a/src/libostree/ostree-repo-traverse.c b/src/libostree/ostree-repo-traverse.c index dc8c135c..7b425bbe 100644 --- a/src/libostree/ostree-repo-traverse.c +++ b/src/libostree/ostree-repo-traverse.c @@ -417,7 +417,7 @@ ostree_repo_traverse_commit_union (OstreeRepo *repo, GError **error) { gboolean ret = FALSE; - gs_free char *tmp_checksum = NULL; + g_autofree char *tmp_checksum = NULL; while (TRUE) { diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c index 106298a4..45ebb264 100644 --- a/src/libostree/ostree-repo.c +++ b/src/libostree/ostree-repo.c @@ -670,7 +670,7 @@ ostree_repo_write_config (OstreeRepo *self, GError **error) { gboolean ret = FALSE; - gs_free char *data = NULL; + g_autofree char *data = NULL; gsize len; g_return_val_if_fail (self->inited, FALSE); @@ -774,7 +774,7 @@ impl_repo_remote_add (OstreeRepo *self, if (sysroot != NULL || ostree_repo_is_system (self)) { const char *sysconf_remotes = SYSCONFDIR "/ostree/remotes.d"; - gs_free char *basename = g_strconcat (name, ".conf", NULL); + g_autofree char *basename = g_strconcat (name, ".conf", NULL); gs_unref_object GFile *etc_ostree_remotes_d = NULL; if (sysroot == NULL) @@ -795,7 +795,7 @@ impl_repo_remote_add (OstreeRepo *self, if (remote->file != NULL) { - gs_free char *data = NULL; + g_autofree char *data = NULL; gsize length; data = g_key_file_to_data (remote->options, &length, NULL); @@ -1051,7 +1051,7 @@ ostree_repo_remote_get_url (OstreeRepo *self, GError **error) { local_cleanup_remote OstreeRemote *remote = NULL; - gs_free char *url = NULL; + g_autofree char *url = NULL; gboolean ret = FALSE; g_return_val_if_fail (name != NULL, FALSE); @@ -1395,9 +1395,9 @@ ostree_repo_open (OstreeRepo *self, gboolean ret = FALSE; gboolean is_archive; struct stat stbuf; - gs_free char *version = NULL; - gs_free char *mode = NULL; - gs_free char *parent_repo_path = NULL; + g_autofree char *version = NULL; + g_autofree char *mode = NULL; + g_autofree char *parent_repo_path = NULL; g_return_val_if_fail (error == NULL || *error == NULL, FALSE); @@ -2828,7 +2828,7 @@ ostree_repo_read_commit (OstreeRepo *self, { gboolean ret = FALSE; gs_unref_object GFile *ret_root = NULL; - gs_free char *resolved_commit = NULL; + g_autofree char *resolved_commit = NULL; if (!ostree_repo_resolve_rev (self, ref, FALSE, &resolved_commit, error)) goto out; @@ -2967,7 +2967,7 @@ ostree_repo_pull_default_console_progress_changed (OstreeAsyncProgress *progress { GSConsole *console = user_data; GString *buf; - gs_free char *status = NULL; + g_autofree char *status = NULL; guint outstanding_fetches; guint outstanding_metadata_fetches; guint outstanding_writes; @@ -2999,9 +2999,9 @@ ostree_repo_pull_default_console_progress_changed (OstreeAsyncProgress *progress guint metadata_fetched = ostree_async_progress_get_uint (progress, "metadata-fetched"); guint requested = ostree_async_progress_get_uint (progress, "requested"); guint64 bytes_sec = (g_get_monotonic_time () - ostree_async_progress_get_uint64 (progress, "start-time")) / G_USEC_PER_SEC; - gs_free char *formatted_bytes_transferred = + g_autofree char *formatted_bytes_transferred = g_format_size_full (bytes_transferred, 0); - gs_free char *formatted_bytes_sec = NULL; + g_autofree char *formatted_bytes_sec = NULL; if (!bytes_sec) // Ignore first second formatted_bytes_sec = g_strdup ("-"); @@ -3014,7 +3014,7 @@ ostree_repo_pull_default_console_progress_changed (OstreeAsyncProgress *progress if (total_delta_parts > 0) { guint64 total_delta_part_size = ostree_async_progress_get_uint64 (progress, "total-delta-part-size"); - gs_free char *formatted_total = + g_autofree char *formatted_total = g_format_size (total_delta_part_size); g_string_append_printf (buf, "Receiving delta parts: %u/%u %s/s %s/%s", fetched_delta_parts, total_delta_parts, @@ -3345,9 +3345,9 @@ ostree_repo_sign_delta (OstreeRepo *self, gs_unref_bytes GBytes *delta_data = NULL; gs_unref_bytes GBytes *signature_data = NULL; gs_unref_variant GVariant *commit_variant = NULL; - gs_free char *delta_path = NULL; + g_autofree char *delta_path = NULL; gs_unref_object GFile *delta_file = NULL; - gs_free char *detached_metadata_relpath = NULL; + g_autofree char *detached_metadata_relpath = NULL; gs_unref_object GFile *detached_metadata_path = NULL; gs_unref_variant GVariant *existing_detached_metadata = NULL; gs_unref_variant GVariant *normalized = NULL; @@ -3538,7 +3538,7 @@ ostree_repo_verify_commit_ext (OstreeRepo *self, gs_unref_object GFile *keyringdir_ref = NULL; gs_unref_variant GVariant *metadata = NULL; gs_unref_bytes GBytes *signed_data = NULL; - gs_free gchar *commit_filename = NULL; + g_autofree char *commit_filename = NULL; /* Create a temporary file for the commit */ if (!ostree_repo_load_variant (self, OSTREE_OBJECT_TYPE_COMMIT, diff --git a/src/libostree/ostree-sepolicy.c b/src/libostree/ostree-sepolicy.c index 91c78b47..71e59e18 100644 --- a/src/libostree/ostree-sepolicy.c +++ b/src/libostree/ostree-sepolicy.c @@ -194,7 +194,7 @@ initable_init (GInitable *initable, { gsize len; GError *temp_error = NULL; - gs_free char *line = g_data_input_stream_read_line_utf8 (datain, &len, + g_autofree char *line = g_data_input_stream_read_line_utf8 (datain, &len, cancellable, &temp_error); if (temp_error) @@ -397,7 +397,7 @@ ostree_sepolicy_restorecon (OstreeSePolicy *self, #ifdef HAVE_SELINUX gboolean ret = FALSE; gs_unref_object GFileInfo *src_info = NULL; - gs_free char *label = NULL; + g_autofree char *label = NULL; gboolean do_relabel = TRUE; if (info != NULL) @@ -475,7 +475,7 @@ ostree_sepolicy_setfscreatecon (OstreeSePolicy *self, { #ifdef HAVE_SELINUX gboolean ret = FALSE; - gs_free char *label = NULL; + g_autofree char *label = NULL; /* setfscreatecon() will bomb out if the host has SELinux disabled, * but we're enabled for the target system. This is kind of a diff --git a/src/libostree/ostree-sysroot-cleanup.c b/src/libostree/ostree-sysroot-cleanup.c index 30f1936d..02bbe567 100644 --- a/src/libostree/ostree-sysroot-cleanup.c +++ b/src/libostree/ostree-sysroot-cleanup.c @@ -63,7 +63,7 @@ _ostree_sysroot_list_deployment_dirs_for_os (GFile *osdir, GFileInfo *file_info = NULL; GFile *child = NULL; gs_unref_object OstreeDeployment *deployment = NULL; - gs_free char *csum = NULL; + g_autofree char *csum = NULL; gint deployserial; if (!gs_file_enumerator_iterate (dir_enum, &file_info, &child, @@ -368,8 +368,8 @@ cleanup_old_deployments (OstreeSysroot *self, for (i = 0; i < all_boot_dirs->len; i++) { GFile *bootdir = all_boot_dirs->pdata[i]; - gs_free char *osname = NULL; - gs_free char *bootcsum = NULL; + g_autofree char *osname = NULL; + g_autofree char *bootcsum = NULL; if (!parse_bootdir_name (gs_file_get_basename_cached (bootdir), &osname, &bootcsum)) @@ -395,7 +395,7 @@ cleanup_ref_prefix (OstreeRepo *repo, GError **error) { gboolean ret = FALSE; - gs_free char *prefix = NULL; + g_autofree char *prefix = NULL; gs_unref_hashtable GHashTable *refs = NULL; GHashTableIter hashiter; gpointer hashkey, hashvalue; @@ -412,7 +412,7 @@ cleanup_ref_prefix (OstreeRepo *repo, while (g_hash_table_iter_next (&hashiter, &hashkey, &hashvalue)) { const char *suffix = hashkey; - gs_free char *ref = g_strconcat (prefix, "/", suffix, NULL); + g_autofree char *ref = g_strconcat (prefix, "/", suffix, NULL); ostree_repo_transaction_set_refspec (repo, ref, NULL); } @@ -459,7 +459,7 @@ generate_deployment_refs_and_prune (OstreeSysroot *self, for (i = 0; i < deployments->len; i++) { OstreeDeployment *deployment = deployments->pdata[i]; - gs_free char *refname = g_strdup_printf ("ostree/%d/%d/%u", + g_autofree char *refname = g_strdup_printf ("ostree/%d/%d/%u", bootversion, subbootversion, i); diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c index c95187a4..eb8f250f 100644 --- a/src/libostree/ostree-sysroot-deploy.c +++ b/src/libostree/ostree-sysroot-deploy.c @@ -190,7 +190,7 @@ ensure_directory_from_template (int orig_etc_fd, } else if (errno == ENOENT) { - gs_free char *parent_path = g_path_get_dirname (path); + g_autofree char *parent_path = g_path_get_dirname (path); if (strcmp (parent_path, ".") != 0) { @@ -266,7 +266,7 @@ copy_modified_config_file (int orig_etc_fd, if (strchr (path, '/') != NULL) { - gs_free char *parent = g_path_get_dirname (path); + g_autofree char *parent = g_path_get_dirname (path); if (!ensure_directory_from_template (orig_etc_fd, modified_etc_fd, new_etc_fd, parent, &dest_parent_dfd, cancellable, error)) @@ -414,7 +414,7 @@ merge_etc_changes (GFile *orig_etc, { GFile *file = removed->pdata[i]; gs_unref_object GFile *target_file = NULL; - gs_free char *path = NULL; + g_autofree char *path = NULL; path = g_file_get_relative_path (orig_etc, file); g_assert (path); @@ -427,7 +427,7 @@ merge_etc_changes (GFile *orig_etc, for (i = 0; i < modified->len; i++) { OstreeDiffItem *diff = modified->pdata[i]; - gs_free char *path = g_file_get_relative_path (modified_etc, diff->target); + g_autofree char *path = g_file_get_relative_path (modified_etc, diff->target); g_assert (path); @@ -438,7 +438,7 @@ merge_etc_changes (GFile *orig_etc, for (i = 0; i < added->len; i++) { GFile *file = added->pdata[i]; - gs_free char *path = g_file_get_relative_path (modified_etc, file); + g_autofree char *path = g_file_get_relative_path (modified_etc, file); g_assert (path); @@ -475,7 +475,7 @@ checkout_deployment_tree (OstreeSysroot *sysroot, gboolean ret = FALSE; OstreeRepoCheckoutOptions checkout_opts = { 0, }; const char *csum = ostree_deployment_get_csum (deployment); - gs_free char *checkout_target_name = NULL; + g_autofree char *checkout_target_name = NULL; g_autofree char *osdeploy_path = NULL; gs_unref_object GFile *ret_deploy_target_path = NULL; glnx_fd_close int osdeploy_dfd = -1; @@ -538,7 +538,7 @@ relabel_one_path (OstreeSysroot *sysroot, GError **error) { gboolean ret = FALSE; - gs_free char *relpath = NULL; + g_autofree char *relpath = NULL; relpath = ptrarray_path_join (path_parts); if (!ostree_sepolicy_restorecon (sepolicy, relpath, @@ -851,7 +851,7 @@ ostree_sysroot_write_origin_file (OstreeSysroot *sysroot, gs_unref_object GFile *deployment_path = ostree_sysroot_get_deployment_directory (sysroot, deployment); gs_unref_object GFile *origin_path = ostree_sysroot_get_deployment_origin_path (deployment_path); gs_unref_object GFile *origin_parent = g_file_get_parent (origin_path); - gs_free char *contents = NULL; + g_autofree char *contents = NULL; gsize len; gs_unref_bytes GBytes *contents_bytes = NULL; @@ -887,8 +887,8 @@ get_kernel_from_tree (GFile *deployroot, gs_unref_object GFileEnumerator *dir_enum = NULL; gs_unref_object GFile *ret_kernel = NULL; gs_unref_object GFile *ret_initramfs = NULL; - gs_free char *kernel_checksum = NULL; - gs_free char *initramfs_checksum = NULL; + g_autofree char *kernel_checksum = NULL; + g_autofree char *initramfs_checksum = NULL; if (g_file_query_exists (ostree_bootdir, NULL)) { @@ -1055,9 +1055,9 @@ swap_bootlinks (OstreeSysroot *self, int old_subbootversion; int new_subbootversion; gs_unref_object GFile *ostree_dir = g_file_get_child (self->path, "ostree"); - gs_free char *ostree_bootdir_name = g_strdup_printf ("boot.%d", bootversion); + g_autofree char *ostree_bootdir_name = g_strdup_printf ("boot.%d", bootversion); gs_unref_object GFile *ostree_bootdir = g_file_resolve_relative_path (ostree_dir, ostree_bootdir_name); - gs_free char *ostree_subbootdir_name = NULL; + g_autofree char *ostree_subbootdir_name = NULL; gs_unref_object GFile *ostree_subbootdir = NULL; if (bootversion != self->bootversion) @@ -1083,11 +1083,11 @@ swap_bootlinks (OstreeSysroot *self, for (i = 0; i < new_deployments->len; i++) { OstreeDeployment *deployment = new_deployments->pdata[i]; - gs_free char *bootlink_pathname = g_strdup_printf ("%s/%s/%d", + g_autofree char *bootlink_pathname = g_strdup_printf ("%s/%s/%d", ostree_deployment_get_osname (deployment), ostree_deployment_get_bootcsum (deployment), ostree_deployment_get_bootserial (deployment)); - gs_free char *bootlink_target = g_strdup_printf ("../../../deploy/%s/deploy/%s.%d", + g_autofree char *bootlink_target = g_strdup_printf ("../../../deploy/%s/deploy/%s.%d", ostree_deployment_get_osname (deployment), ostree_deployment_get_csum (deployment), ostree_deployment_get_deployserial (deployment)); @@ -1177,23 +1177,23 @@ install_deployment_kernel (OstreeSysroot *sysroot, gs_unref_object GFile *bootcsumdir = NULL; gs_unref_object GFile *bootconfpath = NULL; gs_unref_object GFile *bootconfpath_parent = NULL; - gs_free char *dest_kernel_name = NULL; + g_autofree char *dest_kernel_name = NULL; gs_unref_object GFile *dest_kernel_path = NULL; gs_unref_object GFile *dest_initramfs_path = NULL; gs_unref_object GFile *tree_kernel_path = NULL; gs_unref_object GFile *tree_initramfs_path = NULL; gs_unref_object GFile *deployment_dir = NULL; glnx_fd_close int deployment_dfd = -1; - gs_free char *contents = NULL; - gs_free char *deployment_version = NULL; + g_autofree char *contents = NULL; + g_autofree char *deployment_version = NULL; gs_unref_hashtable GHashTable *osrelease_values = NULL; - gs_free char *linux_relpath = NULL; - gs_free char *linux_key = NULL; - gs_free char *initramfs_relpath = NULL; - gs_free char *initrd_key = NULL; - gs_free char *version_key = NULL; - gs_free char *ostree_kernel_arg = NULL; - gs_free char *options_key = NULL; + g_autofree char *linux_relpath = NULL; + g_autofree char *linux_key = NULL; + g_autofree char *initramfs_relpath = NULL; + g_autofree char *initrd_key = NULL; + g_autofree char *version_key = NULL; + g_autofree char *ostree_kernel_arg = NULL; + g_autofree char *options_key = NULL; GString *title_key; __attribute__((cleanup(_ostree_kernel_args_cleanup))) OstreeKernelArgs *kargs = NULL; const char *val; @@ -1236,7 +1236,7 @@ install_deployment_kernel (OstreeSysroot *sysroot, if (tree_initramfs_path) { - gs_free char *dest_initramfs_name = remove_checksum_from_kernel_name (gs_file_get_basename_cached (tree_initramfs_path), + g_autofree char *dest_initramfs_name = remove_checksum_from_kernel_name (gs_file_get_basename_cached (tree_initramfs_path), bootcsum); dest_initramfs_path = g_file_get_child (bootcsumdir, dest_initramfs_name); @@ -1381,7 +1381,7 @@ swap_bootloader (OstreeSysroot *sysroot, { gboolean ret = FALSE; gs_unref_object GFile *boot_loader_link = NULL; - gs_free char *new_target = NULL; + g_autofree char *new_target = NULL; g_assert ((current_bootversion == 0 && new_bootversion == 1) || (current_bootversion == 1 && new_bootversion == 0)); @@ -1437,8 +1437,8 @@ deployment_bootconfigs_equal (OstreeDeployment *a, const char *b_boot_options = ostree_bootconfig_parser_get (b_bootconfig, "options"); __attribute__((cleanup(_ostree_kernel_args_cleanup))) OstreeKernelArgs *a_kargs = NULL; __attribute__((cleanup(_ostree_kernel_args_cleanup))) OstreeKernelArgs *b_kargs = NULL; - gs_free char *a_boot_options_without_ostree = NULL; - gs_free char *b_boot_options_without_ostree = NULL; + g_autofree char *a_boot_options_without_ostree = NULL; + g_autofree char *b_boot_options_without_ostree = NULL; /* We checksum the kernel arguments *except* ostree= */ a_kargs = _ostree_kernel_args_from_string (a_boot_options); @@ -1775,7 +1775,7 @@ ostree_sysroot_deploy_tree (OstreeSysroot *self, gs_unref_object GFile *tree_initramfs_path = NULL; glnx_fd_close int deployment_dfd = -1; gs_unref_object OstreeSePolicy *sepolicy = NULL; - gs_free char *new_bootcsum = NULL; + g_autofree char *new_bootcsum = NULL; gs_unref_object OstreeBootconfigParser *bootconfig = NULL; g_return_val_if_fail (osname != NULL || self->booted_deployment != NULL, FALSE); @@ -1888,7 +1888,7 @@ ostree_sysroot_deploy_tree (OstreeSysroot *self, if (override_kernel_argv) { __attribute__((cleanup(_ostree_kernel_args_cleanup))) OstreeKernelArgs *kargs = NULL; - gs_free char *new_options = NULL; + g_autofree char *new_options = NULL; kargs = _ostree_kernel_args_new (); _ostree_kernel_args_append_argv (kargs, override_kernel_argv); @@ -1925,7 +1925,7 @@ ostree_sysroot_deployment_set_kargs (OstreeSysroot *self, gs_unref_ptrarray GPtrArray *new_deployments = g_ptr_array_new_with_free_func (g_object_unref); gs_unref_object OstreeDeployment *new_deployment = NULL; __attribute__((cleanup(_ostree_kernel_args_cleanup))) OstreeKernelArgs *kargs = NULL; - gs_free char *new_options = NULL; + g_autofree char *new_options = NULL; OstreeBootconfigParser *new_bootconfig; new_deployment = ostree_deployment_clone (deployment); diff --git a/src/libostree/ostree-sysroot-upgrader.c b/src/libostree/ostree-sysroot-upgrader.c index 997ea6bd..9bcd7119 100644 --- a/src/libostree/ostree-sysroot-upgrader.c +++ b/src/libostree/ostree-sysroot-upgrader.c @@ -71,8 +71,8 @@ parse_refspec (OstreeSysrootUpgrader *self, GError **error) { gboolean ret = FALSE; - gs_free char *origin_refspec = NULL; - gs_free char *unconfigured_state = NULL; + g_autofree char *origin_refspec = NULL; + g_autofree char *unconfigured_state = NULL; if ((self->flags & OSTREE_SYSROOT_UPGRADER_FLAGS_IGNORE_UNCONFIGURED) == 0) { @@ -423,8 +423,8 @@ ostree_sysroot_upgrader_check_timestamps (OstreeRepo *repo, { GDateTime *old_ts = g_date_time_new_from_unix_utc (ostree_commit_get_timestamp (old_commit)); GDateTime *new_ts = g_date_time_new_from_unix_utc (ostree_commit_get_timestamp (new_commit)); - gs_free char *old_ts_str = NULL; - gs_free char *new_ts_str = NULL; + g_autofree char *old_ts_str = NULL; + g_autofree char *new_ts_str = NULL; g_assert (old_ts); g_assert (new_ts); @@ -496,8 +496,8 @@ ostree_sysroot_upgrader_pull_one_dir (OstreeSysrootUpgrader *self, gs_unref_object OstreeRepo *repo = NULL; char *refs_to_fetch[] = { self->origin_ref, NULL }; const char *from_revision = NULL; - gs_free char *new_revision = NULL; - gs_free char *origin_refspec = NULL; + g_autofree char *new_revision = NULL; + g_autofree char *origin_refspec = NULL; if (!ostree_sysroot_get_repo (self->sysroot, &repo, cancellable, error)) goto out; diff --git a/src/libostree/ostree-sysroot.c b/src/libostree/ostree-sysroot.c index 8240ff46..1e1c037f 100644 --- a/src/libostree/ostree-sysroot.c +++ b/src/libostree/ostree-sysroot.c @@ -282,7 +282,7 @@ _ostree_sysroot_parse_deploy_path_name (const char *name, { gboolean ret = FALSE; __attribute__((cleanup(match_info_cleanup))) GMatchInfo *match = NULL; - gs_free char *serial_str = NULL; + g_autofree char *serial_str = NULL; static gsize regex_initialized; static GRegex *regex; @@ -319,7 +319,7 @@ _ostree_sysroot_read_current_subbootversion (OstreeSysroot *self, { gboolean ret = FALSE; struct stat stbuf; - gs_free char *ostree_bootdir_name = g_strdup_printf ("ostree/boot.%d", bootversion); + g_autofree char *ostree_bootdir_name = g_strdup_printf ("ostree/boot.%d", bootversion); if (!ensure_sysroot_fd (self, error)) goto out; @@ -336,7 +336,7 @@ _ostree_sysroot_read_current_subbootversion (OstreeSysroot *self, } else { - gs_free char *current_subbootdir_name = NULL; + g_autofree char *current_subbootdir_name = NULL; current_subbootdir_name = glnx_readlinkat_malloc (self->sysroot_fd, ostree_bootdir_name, cancellable, error); @@ -498,7 +498,7 @@ parse_origin (OstreeSysroot *self, g_autoptr(GKeyFile) ret_origin = NULL; g_autofree char *origin_path = g_strconcat ("../", deployment_name, ".origin", NULL); struct stat stbuf; - gs_free char *origin_contents = NULL; + g_autofree char *origin_contents = NULL; ret_origin = g_key_file_new (); @@ -543,8 +543,8 @@ parse_bootlink (const char *bootlink, { gboolean ret = FALSE; __attribute__((cleanup(match_info_cleanup))) GMatchInfo *match = NULL; - gs_free char *bootversion_str = NULL; - gs_free char *treebootserial_str = NULL; + g_autofree char *bootversion_str = NULL; + g_autofree char *treebootserial_str = NULL; static gsize regex_initialized; static GRegex *regex; @@ -588,9 +588,9 @@ parse_deployment (OstreeSysroot *self, int entry_boot_version; int treebootserial = -1; int deployserial = -1; - gs_free char *osname = NULL; - gs_free char *bootcsum = NULL; - gs_free char *treecsum = NULL; + g_autofree char *osname = NULL; + g_autofree char *bootcsum = NULL; + g_autofree char *treecsum = NULL; glnx_fd_close int deployment_dfd = -1; const char *deploy_basename; g_autofree char *treebootserial_target = NULL; @@ -675,7 +675,7 @@ list_deployments_process_one_boot_entry (OstreeSysroot *self, GError **error) { gboolean ret = FALSE; - gs_free char *ostree_arg = NULL; + g_autofree char *ostree_arg = NULL; gs_unref_object OstreeDeployment *deployment = NULL; ostree_arg = get_ostree_kernel_arg_from_config (config); @@ -996,7 +996,7 @@ parse_kernel_commandline (OstreeKernelArgs **out_args, { gboolean ret = FALSE; gs_unref_object GFile *proc_cmdline = g_file_new_for_path ("/proc/cmdline"); - gs_free char *contents = NULL; + g_autofree char *contents = NULL; gsize len; if (!g_file_load_contents (proc_cmdline, cancellable, &contents, &len, NULL, diff --git a/src/libotutil/ot-checksum-utils.c b/src/libotutil/ot-checksum-utils.c index 290eda75..525b148a 100644 --- a/src/libotutil/ot-checksum-utils.c +++ b/src/libotutil/ot-checksum-utils.c @@ -112,7 +112,7 @@ ot_gio_splice_get_checksum (GOutputStream *out, { gboolean ret = FALSE; GChecksum *checksum = NULL; - gs_free guchar *ret_csum = NULL; + g_autofree guchar *ret_csum = NULL; checksum = g_checksum_new (G_CHECKSUM_SHA256); diff --git a/src/libotutil/ot-fs-utils.c b/src/libotutil/ot-fs-utils.c index b0f41a64..416d2bb9 100644 --- a/src/libotutil/ot-fs-utils.c +++ b/src/libotutil/ot-fs-utils.c @@ -61,7 +61,7 @@ ot_lgetxattrat (int dfd, /* A workaround for the lack of lgetxattrat(), thanks to Florian Weimer: * https://mail.gnome.org/archives/ostree-list/2014-February/msg00017.html */ - gs_free char *full_path = g_strdup_printf ("/proc/self/fd/%d/%s", dfd, path); + g_autofree char *full_path = g_strdup_printf ("/proc/self/fd/%d/%s", dfd, path); GBytes *bytes = NULL; ssize_t bytes_read, real_size; char *buf; @@ -103,7 +103,7 @@ ot_lsetxattrat (int dfd, /* A workaround for the lack of lsetxattrat(), thanks to Florian Weimer: * https://mail.gnome.org/archives/ostree-list/2014-February/msg00017.html */ - gs_free char *full_path = g_strdup_printf ("/proc/self/fd/%d/%s", dfd, path); + g_autofree char *full_path = g_strdup_printf ("/proc/self/fd/%d/%s", dfd, path); int res; do diff --git a/src/libotutil/ot-gio-utils.c b/src/libotutil/ot-gio-utils.c index 3028a456..bb8675a7 100644 --- a/src/libotutil/ot-gio-utils.c +++ b/src/libotutil/ot-gio-utils.c @@ -56,7 +56,7 @@ ot_gfile_from_build_path (const char *first, ...) { va_list args; const char *arg; - gs_free char *path = NULL; + g_autofree char *path = NULL; gs_unref_ptrarray GPtrArray *components = NULL; va_start (args, first); @@ -113,7 +113,7 @@ ot_gfile_get_child_build_path (GFile *parent, { va_list args; const char *arg; - gs_free char *path = NULL; + g_autofree char *path = NULL; gs_unref_ptrarray GPtrArray *components = NULL; va_start (args, first); @@ -142,7 +142,7 @@ ot_gfile_resolve_path_printf (GFile *path, ...) { va_list args; - gs_free char *relpath = NULL; + g_autofree char *relpath = NULL; va_start (args, format); relpath = g_strdup_vprintf (format, args); @@ -252,7 +252,7 @@ ot_gfile_load_contents_utf8_allow_noent (GFile *path, { gboolean ret = FALSE; GError *temp_error = NULL; - gs_free char *ret_contents = NULL; + g_autofree char *ret_contents = NULL; ret_contents = gs_file_load_contents_utf8 (path, cancellable, &temp_error); if (!ret_contents) @@ -290,7 +290,7 @@ ot_file_replace_contents_at (int dfd, { gboolean ret = FALSE; int fd; - gs_free char *tmpname = NULL; + g_autofree char *tmpname = NULL; gs_unref_object GOutputStream *stream = NULL; gs_unref_object GInputStream *instream = NULL; @@ -529,7 +529,7 @@ ot_gfile_atomic_symlink_swap (GFile *path, { gboolean ret = FALSE; gs_unref_object GFile *parent = g_file_get_parent (path); - gs_free char *tmpname = g_strconcat (gs_file_get_basename_cached (path), ".tmp", NULL); + g_autofree char *tmpname = g_strconcat (gs_file_get_basename_cached (path), ".tmp", NULL); gs_unref_object GFile *tmppath = g_file_get_child (parent, tmpname); int parent_dfd = -1; diff --git a/src/libotutil/ot-keyfile-utils.c b/src/libotutil/ot-keyfile-utils.c index c585108b..7a12e5fa 100644 --- a/src/libotutil/ot-keyfile-utils.c +++ b/src/libotutil/ot-keyfile-utils.c @@ -73,7 +73,7 @@ ot_keyfile_get_value_with_default (GKeyFile *keyfile, { gboolean ret = FALSE; GError *temp_error = NULL; - gs_free char *ret_value = NULL; + g_autofree char *ret_value = NULL; g_return_val_if_fail (keyfile != NULL, ret); g_return_val_if_fail (section != NULL, ret); @@ -120,7 +120,7 @@ ot_keyfile_copy_group (GKeyFile *source_keyfile, for (ii = 0; ii < length; ii++) { - gs_free char *value = NULL; + g_autofree char *value = NULL; value = g_key_file_get_value (source_keyfile, group_name, keys[ii], NULL); g_key_file_set_value (target_keyfile, group_name, keys[ii], value); diff --git a/src/ostree/ot-admin-builtin-deploy.c b/src/ostree/ot-admin-builtin-deploy.c index 1872894b..b2b24f03 100644 --- a/src/ostree/ot-admin-builtin-deploy.c +++ b/src/ostree/ot-admin-builtin-deploy.c @@ -61,7 +61,7 @@ ot_admin_builtin_deploy (int argc, char **argv, GCancellable *cancellable, GErro gs_unref_ptrarray GPtrArray *new_deployments = NULL; gs_unref_object OstreeDeployment *new_deployment = NULL; gs_unref_object OstreeDeployment *merge_deployment = NULL; - gs_free char *revision = NULL; + g_autofree char *revision = NULL; __attribute__((cleanup(_ostree_kernel_args_cleanup))) OstreeKernelArgs *kargs = NULL; context = g_option_context_new ("REFSPEC - Checkout revision REFSPEC as the new default deployment"); diff --git a/src/ostree/ot-admin-builtin-instutil.c b/src/ostree/ot-admin-builtin-instutil.c index 58bb78f9..d271da7e 100644 --- a/src/ostree/ot-admin-builtin-instutil.c +++ b/src/ostree/ot-admin-builtin-instutil.c @@ -74,7 +74,7 @@ ot_admin_builtin_instutil (int argc, char **argv, GCancellable *cancellable, GEr gboolean ret = FALSE; OstreeAdminInstUtilCommand *subcommand; const char *subcommand_name = NULL; - gs_free char *prgname = NULL; + g_autofree char *prgname = NULL; int in, out; for (in = 1, out = 1; in < argc; in++, out++) @@ -111,7 +111,7 @@ ot_admin_builtin_instutil (int argc, char **argv, GCancellable *cancellable, GEr if (!subcommand->name) { GOptionContext *context; - gs_free char *help; + g_autofree char *help; context = ostree_admin_instutil_option_context_new_with_commands (); diff --git a/src/ostree/ot-admin-builtin-set-origin.c b/src/ostree/ot-admin-builtin-set-origin.c index ed2b44af..bcf1b380 100644 --- a/src/ostree/ot-admin-builtin-set-origin.c +++ b/src/ostree/ot-admin-builtin-set-origin.c @@ -101,8 +101,8 @@ ot_admin_builtin_set_origin (int argc, char **argv, GCancellable *cancellable, G for (iter = opt_set; iter && *iter; iter++) { const char *keyvalue = *iter; - gs_free char *subkey = NULL; - gs_free char *subvalue = NULL; + g_autofree char *subkey = NULL; + g_autofree char *subvalue = NULL; if (!ot_parse_keyvalue (keyvalue, &subkey, &subvalue, error)) goto out; @@ -120,15 +120,15 @@ ot_admin_builtin_set_origin (int argc, char **argv, GCancellable *cancellable, G } { GKeyFile *old_origin = ostree_deployment_get_origin (target_deployment); - gs_free char *origin_refspec = g_key_file_get_string (old_origin, "origin", "refspec", NULL); - gs_free char *new_refspec = NULL; - gs_free char *origin_remote = NULL; - gs_free char *origin_ref = NULL; + g_autofree char *origin_refspec = g_key_file_get_string (old_origin, "origin", "refspec", NULL); + g_autofree char *new_refspec = NULL; + g_autofree char *origin_remote = NULL; + g_autofree char *origin_ref = NULL; if (!ostree_parse_refspec (origin_refspec, &origin_remote, &origin_ref, error)) goto out; - { gs_free char *new_refspec = g_strconcat (remotename, ":", branch ? branch : origin_ref, NULL); + { g_autofree char *new_refspec = g_strconcat (remotename, ":", branch ? branch : origin_ref, NULL); gs_unref_keyfile GKeyFile *new_origin = NULL; gs_unref_object GFile *origin_path = NULL; diff --git a/src/ostree/ot-admin-builtin-status.c b/src/ostree/ot-admin-builtin-status.c index 802aaa8e..242a915d 100644 --- a/src/ostree/ot-admin-builtin-status.c +++ b/src/ostree/ot-admin-builtin-status.c @@ -57,8 +57,8 @@ deployment_get_gpg_verify (OstreeDeployment *deployment, * API in libostree if the OstreeRepo parameter is acceptable. */ GKeyFile *origin; - gs_free char *refspec = NULL; - gs_free char *remote = NULL; + g_autofree char *refspec = NULL; + g_autofree char *remote = NULL; gboolean gpg_verify = FALSE; origin = ostree_deployment_get_origin (deployment); @@ -119,7 +119,7 @@ ot_admin_builtin_status (int argc, char **argv, GCancellable *cancellable, GErro OstreeDeployment *deployment = deployments->pdata[i]; GKeyFile *origin; const char *ref = ostree_deployment_get_csum (deployment); - gs_free gchar *version = version_of_commit (repo, ref); + g_autofree char *version = version_of_commit (repo, ref); gs_unref_object OstreeGpgVerifyResult *result = NULL; GString *output_buffer; guint jj, n_signatures; @@ -137,7 +137,7 @@ ot_admin_builtin_status (int argc, char **argv, GCancellable *cancellable, GErro g_print (" origin: none\n"); else { - gs_free char *origin_refspec = g_key_file_get_string (origin, "origin", "refspec", NULL); + g_autofree char *origin_refspec = g_key_file_get_string (origin, "origin", "refspec", NULL); if (!origin_refspec) g_print (" origin: \n"); else diff --git a/src/ostree/ot-admin-builtin-switch.c b/src/ostree/ot-admin-builtin-switch.c index ab6334f1..9a0a5ced 100644 --- a/src/ostree/ot-admin-builtin-switch.c +++ b/src/ostree/ot-admin-builtin-switch.c @@ -47,13 +47,13 @@ ot_admin_builtin_switch (int argc, char **argv, GCancellable *cancellable, GErro gs_unref_object OstreeSysroot *sysroot = NULL; const char *new_provided_refspec = NULL; gs_unref_object OstreeRepo *repo = NULL; - gs_free char *origin_refspec = NULL; - gs_free char *origin_remote = NULL; - gs_free char *origin_ref = NULL; - gs_free char *new_remote = NULL; - gs_free char *new_ref = NULL; - gs_free char *new_refspec = NULL; - gs_free char *new_revision = NULL; + g_autofree char *origin_refspec = NULL; + g_autofree char *origin_remote = NULL; + g_autofree char *origin_ref = NULL; + g_autofree char *new_remote = NULL; + g_autofree char *new_ref = NULL; + g_autofree char *new_refspec = NULL; + g_autofree char *new_revision = NULL; gs_unref_object GFile *deployment_path = NULL; gs_unref_object GFile *deployment_origin_path = NULL; gs_unref_object OstreeDeployment *merge_deployment = NULL; diff --git a/src/ostree/ot-admin-builtin-upgrade.c b/src/ostree/ot-admin-builtin-upgrade.c index 25308aaf..d244aee7 100644 --- a/src/ostree/ot-admin-builtin-upgrade.c +++ b/src/ostree/ot-admin-builtin-upgrade.c @@ -51,10 +51,10 @@ ot_admin_builtin_upgrade (int argc, char **argv, GCancellable *cancellable, GErr GOptionContext *context; gs_unref_object OstreeSysroot *sysroot = NULL; gs_unref_object OstreeSysrootUpgrader *upgrader = NULL; - gs_free char *origin_remote = NULL; - gs_free char *origin_ref = NULL; - gs_free char *origin_refspec = NULL; - gs_free char *new_revision = NULL; + g_autofree char *origin_remote = NULL; + g_autofree char *origin_ref = NULL; + g_autofree char *origin_refspec = NULL; + g_autofree char *new_revision = NULL; gs_unref_object GFile *deployment_path = NULL; gs_unref_object GFile *deployment_origin_path = NULL; gs_unref_object OstreeDeployment *merge_deployment = NULL; diff --git a/src/ostree/ot-admin-instutil-builtin-selinux-ensure-labeled.c b/src/ostree/ot-admin-instutil-builtin-selinux-ensure-labeled.c index bc20799a..38cbc065 100644 --- a/src/ostree/ot-admin-instutil-builtin-selinux-ensure-labeled.c +++ b/src/ostree/ot-admin-instutil-builtin-selinux-ensure-labeled.c @@ -61,8 +61,8 @@ relabel_one_path (OstreeSePolicy *sepolicy, GError **error) { gboolean ret = FALSE; - gs_free char *relpath = NULL; - gs_free char *new_label = NULL; + g_autofree char *relpath = NULL; + g_autofree char *new_label = NULL; relpath = ptrarray_path_join (path_parts); if (!ostree_sepolicy_restorecon (sepolicy, relpath, diff --git a/src/ostree/ot-builtin-admin.c b/src/ostree/ot-builtin-admin.c index 6cc63846..8bbda185 100644 --- a/src/ostree/ot-builtin-admin.c +++ b/src/ostree/ot-builtin-admin.c @@ -82,7 +82,7 @@ ostree_builtin_admin (int argc, char **argv, GCancellable *cancellable, GError * gboolean ret = FALSE; const char *subcommand_name = NULL; OstreeAdminCommand *subcommand; - gs_free char *prgname = NULL; + g_autofree char *prgname = NULL; int in, out; /* @@ -125,7 +125,7 @@ ostree_builtin_admin (int argc, char **argv, GCancellable *cancellable, GError * if (!subcommand->name) { GOptionContext *context; - gs_free char *help; + g_autofree char *help; context = ostree_admin_option_context_new_with_commands (); diff --git a/src/ostree/ot-builtin-checkout.c b/src/ostree/ot-builtin-checkout.c index 8a3e1c62..0b9a0aa7 100644 --- a/src/ostree/ot-builtin-checkout.c +++ b/src/ostree/ot-builtin-checkout.c @@ -159,9 +159,9 @@ process_many_checkouts (OstreeRepo *repo, GError *temp_error = NULL; gs_unref_object GInputStream *instream = NULL; gs_unref_object GDataInputStream *datastream = NULL; - gs_free char *revision = NULL; - gs_free char *subpath = NULL; - gs_free char *resolved_commit = NULL; + g_autofree char *revision = NULL; + g_autofree char *subpath = NULL; + g_autofree char *resolved_commit = NULL; if (opt_from_stdin) { @@ -229,7 +229,7 @@ ostree_builtin_checkout (int argc, char **argv, GCancellable *cancellable, GErro gboolean ret = FALSE; const char *commit; const char *destination; - gs_free char *resolved_commit = NULL; + g_autofree char *resolved_commit = NULL; context = g_option_context_new ("COMMIT [DESTINATION] - Check out a commit into a filesystem tree"); diff --git a/src/ostree/ot-builtin-checksum.c b/src/ostree/ot-builtin-checksum.c index 5c534f84..9381bf79 100644 --- a/src/ostree/ot-builtin-checksum.c +++ b/src/ostree/ot-builtin-checksum.c @@ -43,8 +43,8 @@ on_checksum_received (GObject *obj, GAsyncResult *result, gpointer user_data) { - gs_free guchar *csum = NULL; - gs_free char *checksum = NULL; + g_autofree guchar *csum = NULL; + g_autofree char *checksum = NULL; AsyncChecksumData *data = user_data; if (ostree_checksum_file_async_finish ((GFile*)obj, result, &csum, data->error)) diff --git a/src/ostree/ot-builtin-commit.c b/src/ostree/ot-builtin-commit.c index 0a36ef3b..61ac5926 100644 --- a/src/ostree/ot-builtin-commit.c +++ b/src/ostree/ot-builtin-commit.c @@ -97,7 +97,7 @@ parse_statoverride_file (GHashTable **out_mode_add, char **iter = NULL; /* nofree */ gs_unref_hashtable GHashTable *ret_hash = NULL; gs_unref_object GFile *path = NULL; - gs_free char *contents = NULL; + g_autofree char *contents = NULL; char **lines = NULL; path = g_file_new_for_path (opt_statoverride_file); @@ -174,8 +174,8 @@ commit_editor (OstreeRepo *repo, GCancellable *cancellable, GError **error) { - gs_free char *input = NULL; - gs_free char *output = NULL; + g_autofree char *input = NULL; + g_autofree char *output = NULL; gboolean ret = FALSE; GString *bodybuf = NULL; char **lines = NULL; @@ -264,7 +264,7 @@ parse_keyvalue_strings (char **strings, { const char *s; const char *eq; - gs_free char *key = NULL; + g_autofree char *key = NULL; s = *iter; @@ -296,13 +296,13 @@ ostree_builtin_commit (int argc, char **argv, GCancellable *cancellable, GError gboolean ret = FALSE; gboolean skip_commit = FALSE; gs_unref_object GFile *arg = NULL; - gs_free char *parent = NULL; - gs_free char *commit_checksum = NULL; + g_autofree char *parent = NULL; + g_autofree char *commit_checksum = NULL; gs_unref_object GFile *root = NULL; gs_unref_variant GVariant *metadata = NULL; gs_unref_variant GVariant *detached_metadata = NULL; gs_unref_object OstreeMutableTree *mtree = NULL; - gs_free char *tree_type = NULL; + g_autofree char *tree_type = NULL; gs_unref_hashtable GHashTable *mode_adds = NULL; OstreeRepoCommitModifierFlags flags = 0; OstreeRepoCommitModifier *modifier = NULL; diff --git a/src/ostree/ot-builtin-config.c b/src/ostree/ot-builtin-config.c index 235e4985..7590dc1e 100644 --- a/src/ostree/ot-builtin-config.c +++ b/src/ostree/ot-builtin-config.c @@ -61,8 +61,8 @@ ostree_builtin_config (int argc, char **argv, GCancellable *cancellable, GError const char *op; const char *section_key; const char *value; - gs_free char *section = NULL; - gs_free char *key = NULL; + g_autofree char *section = NULL; + g_autofree char *key = NULL; GKeyFile *config = NULL; context = g_option_context_new ("- Change configuration settings"); @@ -102,7 +102,7 @@ ostree_builtin_config (int argc, char **argv, GCancellable *cancellable, GError else if (!strcmp (op, "get")) { GKeyFile *readonly_config = NULL; - gs_free char *value = NULL; + g_autofree char *value = NULL; if (argc < 3) { g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, diff --git a/src/ostree/ot-builtin-diff.c b/src/ostree/ot-builtin-diff.c index 7948c5da..816b80e2 100644 --- a/src/ostree/ot-builtin-diff.c +++ b/src/ostree/ot-builtin-diff.c @@ -123,7 +123,7 @@ ostree_builtin_diff (int argc, char **argv, GCancellable *cancellable, GError ** gs_unref_object OstreeRepo *repo = NULL; const char *src; const char *target; - gs_free char *src_prev = NULL; + g_autofree char *src_prev = NULL; gs_unref_object GFile *srcf = NULL; gs_unref_object GFile *targetf = NULL; gs_unref_ptrarray GPtrArray *modified = NULL; @@ -183,9 +183,9 @@ ostree_builtin_diff (int argc, char **argv, GCancellable *cancellable, GError ** gs_unref_hashtable GHashTable *reachable_a = NULL; gs_unref_hashtable GHashTable *reachable_b = NULL; gs_unref_hashtable GHashTable *reachable_intersection = NULL; - gs_free char *rev_a = NULL; - gs_free char *rev_b = NULL; - gs_free char *size = NULL; + g_autofree char *rev_a = NULL; + g_autofree char *rev_b = NULL; + g_autofree char *size = NULL; guint a_size; guint b_size; guint64 total_common; diff --git a/src/ostree/ot-builtin-fsck.c b/src/ostree/ot-builtin-fsck.c index 8f340439..eb90effc 100644 --- a/src/ostree/ot-builtin-fsck.c +++ b/src/ostree/ot-builtin-fsck.c @@ -142,8 +142,8 @@ load_and_fsck_one_object (OstreeRepo *repo, } else { - gs_free guchar *computed_csum = NULL; - gs_free char *tmp_checksum = NULL; + g_autofree guchar *computed_csum = NULL; + g_autofree char *tmp_checksum = NULL; if (!ostree_checksum_file_from_input (file_info, xattrs, input, objtype, &computed_csum, @@ -153,7 +153,7 @@ load_and_fsck_one_object (OstreeRepo *repo, tmp_checksum = ostree_checksum_from_bytes (computed_csum); if (strcmp (checksum, tmp_checksum) != 0) { - gs_free char *msg = g_strdup_printf ("corrupted object %s.%s; actual checksum: %s", + g_autofree char *msg = g_strdup_printf ("corrupted object %s.%s; actual checksum: %s", checksum, ostree_object_type_to_string (objtype), tmp_checksum); if (opt_delete) diff --git a/src/ostree/ot-builtin-gpg-sign.c b/src/ostree/ot-builtin-gpg-sign.c index 9f596ec1..93c78a4a 100644 --- a/src/ostree/ot-builtin-gpg-sign.c +++ b/src/ostree/ot-builtin-gpg-sign.c @@ -39,7 +39,7 @@ static GOptionEntry options[] = { static void usage_error (GOptionContext *context, const char *message, GError **error) { - gs_free char *help = g_option_context_get_help (context, TRUE, NULL); + g_autofree char *help = g_option_context_get_help (context, TRUE, NULL); g_printerr ("%s", help); g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, message); } @@ -199,7 +199,7 @@ ostree_builtin_gpg_sign (int argc, char **argv, GCancellable *cancellable, GErro { GOptionContext *context; gs_unref_object OstreeRepo *repo = NULL; - gs_free char *resolved_commit = NULL; + g_autofree char *resolved_commit = NULL; const char *commit; char **key_ids; int n_key_ids, ii; diff --git a/src/ostree/ot-builtin-log.c b/src/ostree/ot-builtin-log.c index 5147adb8..edc494ec 100644 --- a/src/ostree/ot-builtin-log.c +++ b/src/ostree/ot-builtin-log.c @@ -43,7 +43,7 @@ log_commit (OstreeRepo *repo, GError **error) { gs_unref_variant GVariant *variant = NULL; - gs_free gchar *parent = NULL; + g_autofree char *parent = NULL; gboolean ret = FALSE; GError *local_error = NULL; @@ -85,7 +85,7 @@ ostree_builtin_log (int argc, gs_unref_object OstreeRepo *repo = NULL; gboolean ret = FALSE; const char *rev; - gs_free char *checksum = NULL; + g_autofree char *checksum = NULL; OstreeDumpFlags flags = OSTREE_DUMP_NONE; context = g_option_context_new ("REF - Show log starting at commit or ref"); diff --git a/src/ostree/ot-builtin-prune.c b/src/ostree/ot-builtin-prune.c index 89ad2e5d..5bef2099 100644 --- a/src/ostree/ot-builtin-prune.c +++ b/src/ostree/ot-builtin-prune.c @@ -44,7 +44,7 @@ ostree_builtin_prune (int argc, char **argv, GCancellable *cancellable, GError * gboolean ret = FALSE; GOptionContext *context; gs_unref_object OstreeRepo *repo = NULL; - gs_free char *formatted_freed_size = NULL; + g_autofree char *formatted_freed_size = NULL; OstreeRepoPruneFlags pruneflags = 0; gint n_objects_total; gint n_objects_pruned; diff --git a/src/ostree/ot-builtin-pull-local.c b/src/ostree/ot-builtin-pull-local.c index 2b7bf67c..991cea17 100644 --- a/src/ostree/ot-builtin-pull-local.c +++ b/src/ostree/ot-builtin-pull-local.c @@ -48,7 +48,7 @@ ostree_builtin_pull_local (int argc, char **argv, GCancellable *cancellable, GEr int i; const char *src_repo_arg; GSConsole *console = NULL; - gs_free char *src_repo_uri = NULL; + g_autofree char *src_repo_uri = NULL; gs_unref_object OstreeAsyncProgress *progress = NULL; gs_unref_ptrarray GPtrArray *refs_to_fetch = NULL; gs_unref_hashtable GHashTable *source_objects = NULL; @@ -77,7 +77,7 @@ ostree_builtin_pull_local (int argc, char **argv, GCancellable *cancellable, GEr src_repo_uri = g_strconcat ("file://", src_repo_arg, NULL); else { - gs_free char *cwd = g_get_current_dir (); + g_autofree char *cwd = g_get_current_dir (); src_repo_uri = g_strconcat ("file://", cwd, "/", src_repo_arg, NULL); } diff --git a/src/ostree/ot-builtin-pull.c b/src/ostree/ot-builtin-pull.c index 5d9eac42..cb407a86 100644 --- a/src/ostree/ot-builtin-pull.c +++ b/src/ostree/ot-builtin-pull.c @@ -60,7 +60,7 @@ ostree_builtin_pull (int argc, char **argv, GCancellable *cancellable, GError ** GOptionContext *context; gs_unref_object OstreeRepo *repo = NULL; gboolean ret = FALSE; - gs_free char *remote = NULL; + g_autofree char *remote = NULL; OstreeRepoPullFlags pullflags = 0; GSConsole *console = NULL; gs_unref_ptrarray GPtrArray *refs_to_fetch = NULL; diff --git a/src/ostree/ot-builtin-refs.c b/src/ostree/ot-builtin-refs.c index 9b02ca95..2b579276 100644 --- a/src/ostree/ot-builtin-refs.c +++ b/src/ostree/ot-builtin-refs.c @@ -80,8 +80,8 @@ ostree_builtin_refs (int argc, char **argv, GCancellable *cancellable, GError ** while (g_hash_table_iter_next (&hashiter, &hashkey, &hashvalue)) { const char *refspec = hashkey; - gs_free char *remote = NULL; - gs_free char *ref = NULL; + g_autofree char *remote = NULL; + g_autofree char *ref = NULL; if (!ostree_parse_refspec (refspec, &remote, &ref, error)) goto out; diff --git a/src/ostree/ot-builtin-reset.c b/src/ostree/ot-builtin-reset.c index c581c92a..6300d162 100644 --- a/src/ostree/ot-builtin-reset.c +++ b/src/ostree/ot-builtin-reset.c @@ -60,8 +60,8 @@ ostree_builtin_reset (int argc, gboolean ret = FALSE; const char *ref; const char *target = NULL; - gs_free gchar *current = NULL; - gs_free gchar *checksum = NULL; + g_autofree char *current = NULL; + g_autofree char *checksum = NULL; context = g_option_context_new ("REF COMMIT - Reset a REF to a previous COMMIT"); diff --git a/src/ostree/ot-builtin-rev-parse.c b/src/ostree/ot-builtin-rev-parse.c index f0835cae..9bd3aaa8 100644 --- a/src/ostree/ot-builtin-rev-parse.c +++ b/src/ostree/ot-builtin-rev-parse.c @@ -39,7 +39,7 @@ ostree_builtin_rev_parse (int argc, char **argv, GCancellable *cancellable, GErr gboolean ret = FALSE; const char *rev = "master"; int i; - gs_free char *resolved_rev = NULL; + g_autofree char *resolved_rev = NULL; context = g_option_context_new ("REV - Output the target of a rev"); diff --git a/src/ostree/ot-builtin-show.c b/src/ostree/ot-builtin-show.c index 1729f913..4303c141 100644 --- a/src/ostree/ot-builtin-show.c +++ b/src/ostree/ot-builtin-show.c @@ -90,7 +90,7 @@ do_print_related (OstreeRepo *repo, while (g_variant_iter_loop (viter, "(&s@ay)", &name, &csum_v)) { - gs_free char *checksum = ostree_checksum_from_bytes_v (csum_v); + g_autofree char *checksum = ostree_checksum_from_bytes_v (csum_v); g_print ("%s %s\n", name, checksum); } csum_v = NULL; @@ -249,7 +249,7 @@ ostree_builtin_show (int argc, char **argv, GCancellable *cancellable, GError ** gs_unref_object OstreeRepo *repo = NULL; gboolean ret = FALSE; const char *rev; - gs_free char *resolved_rev = NULL; + g_autofree char *resolved_rev = NULL; context = g_option_context_new ("OBJECT - Output a metadata object"); @@ -341,7 +341,7 @@ ostree_builtin_show (int argc, char **argv, GCancellable *cancellable, GError ** g_print ("Extended Attributes: "); if (xattrs) { - gs_free char *xattr_string = g_variant_print (xattrs, TRUE); + g_autofree char *xattr_string = g_variant_print (xattrs, TRUE); g_print ("{ %s }\n", xattr_string); } else diff --git a/src/ostree/ot-builtin-static-delta.c b/src/ostree/ot-builtin-static-delta.c index 9eece842..80f83b31 100644 --- a/src/ostree/ot-builtin-static-delta.c +++ b/src/ostree/ot-builtin-static-delta.c @@ -155,9 +155,9 @@ ot_static_delta_builtin_generate (int argc, char **argv, GCancellable *cancellab else { const char *from_source; - gs_free char *from_resolved = NULL; - gs_free char *to_resolved = NULL; - gs_free char *from_parent_str = NULL; + g_autofree char *from_resolved = NULL; + g_autofree char *to_resolved = NULL; + g_autofree char *from_parent_str = NULL; gs_unref_variant_builder GVariantBuilder *parambuilder = NULL; g_assert (opt_to_rev); @@ -332,7 +332,7 @@ ostree_builtin_static_delta (int argc, char **argv, GCancellable *cancellable, G if (!command->fn) { - gs_free char *msg = g_strdup_printf ("Unknown command '%s'", cmdname); + g_autofree char *msg = g_strdup_printf ("Unknown command '%s'", cmdname); static_delta_usage (argv, TRUE); g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, msg); goto out; diff --git a/src/ostree/ot-builtin-trivial-httpd.c b/src/ostree/ot-builtin-trivial-httpd.c index 197b44ff..484c496a 100644 --- a/src/ostree/ot-builtin-trivial-httpd.c +++ b/src/ostree/ot-builtin-trivial-httpd.c @@ -150,7 +150,7 @@ do_get (OtTrivialHttpd *self, char *slash; int ret; struct stat stbuf; - gs_free char *safepath = NULL; + g_autofree char *safepath = NULL; if (strstr (path, "../") != NULL) { @@ -188,7 +188,7 @@ do_get (OtTrivialHttpd *self, slash = strrchr (safepath, '/'); if (!slash || slash[1]) { - gs_free char *redir_uri = NULL; + g_autofree char *redir_uri = NULL; redir_uri = g_strdup_printf ("%s/", soup_message_get_uri (msg)->path); soup_message_set_redirect (msg, SOUP_STATUS_MOVED_PERMANENTLY, @@ -196,10 +196,10 @@ do_get (OtTrivialHttpd *self, } else { - gs_free char *index_realpath = g_strconcat (safepath, "/index.html", NULL); + g_autofree char *index_realpath = g_strconcat (safepath, "/index.html", NULL); if (stat (index_realpath, &stbuf) != -1) { - gs_free char *index_path = g_strconcat (path, "/index.html", NULL); + g_autofree char *index_path = g_strconcat (path, "/index.html", NULL); do_get (self, server, msg, index_path, context); } else @@ -276,7 +276,7 @@ do_get (OtTrivialHttpd *self, } else /* msg->method == SOUP_METHOD_HEAD */ { - gs_free char *length = NULL; + g_autofree char *length = NULL; /* We could just use the same code for both GET and * HEAD (soup-message-server-io.c will fix things up). @@ -360,7 +360,7 @@ ostree_builtin_trivial_httpd (int argc, char **argv, GCancellable *cancellable, soup_server_add_handler (server, NULL, httpd_callback, app, NULL); if (opt_port_file) { - gs_free char *portstr = NULL; + g_autofree char *portstr = NULL; #if SOUP_CHECK_VERSION(2, 48, 0) GSList *listeners = soup_server_get_listeners (server); gs_unref_object GSocket *listener = NULL; diff --git a/src/ostree/ot-dump.c b/src/ostree/ot-dump.c index a9fb623f..c76ea0a7 100644 --- a/src/ostree/ot-dump.c +++ b/src/ostree/ot-dump.c @@ -31,7 +31,7 @@ void ot_dump_variant (GVariant *variant) { - gs_free char *formatted_variant = NULL; + g_autofree char *formatted_variant = NULL; gs_unref_variant GVariant *byteswapped = NULL; if (G_BYTE_ORDER != G_BIG_ENDIAN) @@ -92,8 +92,8 @@ dump_commit (GVariant *variant, const gchar *subject; const gchar *body; guint64 timestamp; - gs_free gchar *str = NULL; - gs_free gchar *version = NULL; + g_autofree char *str = NULL; + g_autofree char *version = NULL; /* See OSTREE_COMMIT_GVARIANT_FORMAT */ g_variant_get (variant, "(a{sv}aya(say)&s&stayay)", NULL, NULL, NULL, diff --git a/src/ostree/ot-editor.c b/src/ostree/ot-editor.c index 05fbe1f1..b84f6872 100644 --- a/src/ostree/ot-editor.c +++ b/src/ostree/ot-editor.c @@ -69,7 +69,7 @@ ot_editor_prompt (OstreeRepo *repo, GOutputStream *output; const char *editor; char *ret = NULL; - gs_free gchar *args = NULL; + g_autofree char *args = NULL; editor = get_editor (); if (editor == NULL) @@ -89,7 +89,7 @@ ot_editor_prompt (OstreeRepo *repo, goto out; { - gs_free gchar *quoted_file = g_shell_quote (gs_file_get_path_cached (file)); + g_autofree char *quoted_file = g_shell_quote (gs_file_get_path_cached (file)); args = g_strconcat (editor, " ", quoted_file, NULL); } ctx = gs_subprocess_context_newv ("/bin/sh", "-c", args, NULL); diff --git a/src/ostree/ot-main.c b/src/ostree/ot-main.c index 0a75beee..595217ed 100644 --- a/src/ostree/ot-main.c +++ b/src/ostree/ot-main.c @@ -84,7 +84,7 @@ ostree_usage (OstreeCommand *commands, gboolean is_error) { GOptionContext *context; - gs_free char *help; + g_autofree char *help; context = ostree_option_context_new_with_commands (commands); @@ -125,7 +125,7 @@ ostree_run (int argc, GError *error = NULL; GCancellable *cancellable = NULL; const char *command_name = NULL; - gs_free char *prgname = NULL; + g_autofree char *prgname = NULL; gboolean success = FALSE; int in, out; @@ -174,7 +174,7 @@ ostree_run (int argc, if (!command->fn) { GOptionContext *context; - gs_free char *help; + g_autofree char *help; context = ostree_option_context_new_with_commands (commands); @@ -265,7 +265,7 @@ ostree_option_context_parse (GOptionContext *context, { if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) { - gs_free char *help = NULL; + g_autofree char *help = NULL; g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Command requires a --repo argument"); @@ -342,7 +342,7 @@ ostree_admin_option_context_parse (GOptionContext *context, gs_unref_ptrarray GPtrArray *deployments = NULL; OstreeDeployment *first_deployment; gs_unref_object GFile *deployment_file = NULL; - gs_free char *deployment_path = NULL; + g_autofree char *deployment_path = NULL; if (!ostree_sysroot_load (sysroot, cancellable, error)) goto out; diff --git a/tests/test-bsdiff.c b/tests/test-bsdiff.c index 1769cb9c..4078a2b8 100644 --- a/tests/test-bsdiff.c +++ b/tests/test-bsdiff.c @@ -66,9 +66,9 @@ test_bsdiff (void) struct bsdiff_stream bsdiff_stream; struct bspatch_stream bspatch_stream; int i; - gs_free guint8 *old = g_new (guint8, OLD_SIZE); - gs_free guint8 *new = g_new (guint8, NEW_SIZE); - gs_free guint8 *new_generated = g_new0 (guint8, NEW_SIZE); + g_autofree guint8 *old = g_new (guint8, OLD_SIZE); + g_autofree guint8 *new = g_new (guint8, NEW_SIZE); + g_autofree guint8 *new_generated = g_new0 (guint8, NEW_SIZE); gs_unref_object GOutputStream *out = g_memory_output_stream_new_resizable (); gs_unref_object GInputStream *in = NULL; diff --git a/tests/test-gpg-verify-result.c b/tests/test-gpg-verify-result.c index c00e90a5..19b23b87 100644 --- a/tests/test-gpg-verify-result.c +++ b/tests/test-gpg-verify-result.c @@ -56,8 +56,8 @@ test_fixture_setup (TestFixture *fixture, gpgme_data_t data_buffer; gpgme_data_t signature_buffer; OstreeGpgVerifyResult *result; - gs_free char *homedir = NULL; - gs_free char *filename = NULL; + g_autofree char *homedir = NULL; + g_autofree char *filename = NULL; GError *local_error = NULL; /* Mimic what OstreeGpgVerifier does to create OstreeGpgVerifyResult. diff --git a/tests/test-keyfile-utils.c b/tests/test-keyfile-utils.c index 25e86f62..551b508b 100644 --- a/tests/test-keyfile-utils.c +++ b/tests/test-keyfile-utils.c @@ -181,8 +181,8 @@ test_copy_group (void) for (ii = 0; ii < length; ii++) { - gs_free char *value = NULL; - gs_free char *value2 = NULL; + g_autofree char *value = NULL; + g_autofree char *value2 = NULL; value = g_key_file_get_value (g_keyfile, section, keys[ii], NULL); value2 = g_key_file_get_value (g_keyfile, section, keys[ii], NULL); diff --git a/tests/test-mutable-tree.c b/tests/test-mutable-tree.c index 771ccabd..d351f40f 100644 --- a/tests/test-mutable-tree.c +++ b/tests/test-mutable-tree.c @@ -72,7 +72,7 @@ test_mutable_tree_walk (void) { gs_unref_object OstreeMutableTree *subdir = NULL; gs_unref_object OstreeMutableTree *a = NULL; - gs_free char *source_checksum = NULL; + g_autofree char *source_checksum = NULL; ostree_mutable_tree_lookup (tree, "a", &source_checksum, &a, &error); g_assert (ostree_mutable_tree_walk (a, split_path, 1, &subdir, &error)); g_assert (subdir); @@ -88,9 +88,9 @@ test_ensure_parent_dirs (void) GError *error = NULL; const char *pathname = "/foo/bar/baz"; const char *checksum = "01234567890123456789012345678901"; - gs_free char *source_checksum = NULL; + g_autofree char *source_checksum = NULL; gs_unref_object OstreeMutableTree *source_subdir = NULL; - gs_free char *source_checksum2 = NULL; + g_autofree char *source_checksum2 = NULL; gs_unref_object OstreeMutableTree *source_subdir2 = NULL; g_assert (ot_util_path_split_validate (pathname, &split_path, &error)); @@ -116,7 +116,7 @@ test_ensure_dir (void) const char *dirname = "foo"; const char *filename = "bar"; const char *checksum = "01234567890123456789012345678901"; - gs_free char *source_checksum = NULL; + g_autofree char *source_checksum = NULL; gs_unref_object OstreeMutableTree *source_subdir = NULL; g_assert (ostree_mutable_tree_ensure_dir (tree, dirname, &parent, &error)); @@ -139,7 +139,7 @@ test_replace_file (void) g_assert (ostree_mutable_tree_replace_file (tree, filename, checksum, &error)); { - gs_free char *out_checksum = NULL; + g_autofree char *out_checksum = NULL; gs_unref_object OstreeMutableTree *subdir = NULL; g_assert (ostree_mutable_tree_lookup (tree, filename, &out_checksum, &subdir, &error)); g_assert_cmpstr (checksum, ==, out_checksum); @@ -147,7 +147,7 @@ test_replace_file (void) g_assert (ostree_mutable_tree_replace_file (tree, filename, checksum2, &error)); { - gs_free char *out_checksum = NULL; + g_autofree char *out_checksum = NULL; gs_unref_object OstreeMutableTree *subdir = NULL; g_assert (ostree_mutable_tree_lookup (tree, filename, &out_checksum, &subdir, &error)); g_assert_cmpstr (checksum2, ==, out_checksum); diff --git a/tests/test-ot-tool-util.c b/tests/test-ot-tool-util.c index e9b35213..04041323 100644 --- a/tests/test-ot-tool-util.c +++ b/tests/test-ot-tool-util.c @@ -87,8 +87,8 @@ test_ot_parse_keyvalue (void) for (i = 0; i < G_N_ELEMENTS (keyvalue); i++) { - gs_free char *out_key = NULL; - gs_free char *out_value = NULL; + g_autofree char *out_key = NULL; + g_autofree char *out_value = NULL; g_assert_true (ot_parse_keyvalue (keyvalue[i], &out_key, &out_value, @@ -98,8 +98,8 @@ test_ot_parse_keyvalue (void) } { - gs_free char *out_key = NULL; - gs_free char *out_value = NULL; + g_autofree char *out_key = NULL; + g_autofree char *out_value = NULL; g_assert_false (ot_parse_keyvalue ("blabla", &out_key, &out_value, diff --git a/tests/test-varint.c b/tests/test-varint.c index e069fc57..c62b397d 100644 --- a/tests/test-varint.c +++ b/tests/test-varint.c @@ -36,7 +36,7 @@ check_one_roundtrip (guint64 val) if (g_test_verbose ()) { gs_unref_variant GVariant *v = g_variant_new_from_data (G_VARIANT_TYPE ("ay"), buf->str, buf->len, TRUE, NULL, NULL); - gs_free char *data = g_variant_print (v, FALSE); + g_autofree char *data = g_variant_print (v, FALSE); g_test_message ("%" G_GUINT64_FORMAT " -> %s", val, data); } g_assert (_ostree_read_varuint64 ((guint8*)buf->str, buf->len, &newval, &bytes_read));