Use g_autoptr(GHashTable) instead of gs_unref_hashtable

This commit is contained in:
Matthew Barnes 2015-05-05 11:43:31 -04:00
parent e6556dd223
commit 196d983af9
19 changed files with 49 additions and 49 deletions

View File

@ -171,7 +171,7 @@ ostree_bootconfig_parser_write (OstreeBootconfigParser *self,
GString *buf = g_string_new ("");
g_autoptr(GBytes) bytes = NULL;
guint i;
gs_unref_hashtable GHashTable *written_overrides = NULL;
g_autoptr(GHashTable) written_overrides = NULL;
written_overrides = g_hash_table_new (g_str_hash, g_str_equal);

View File

@ -850,7 +850,7 @@ ostree_repo_checkout_gc (OstreeRepo *self,
GError **error)
{
gboolean ret = FALSE;
gs_unref_hashtable GHashTable *to_clean_dirs = NULL;
g_autoptr(GHashTable) to_clean_dirs = NULL;
GHashTableIter iter;
gpointer key, value;

View File

@ -2756,8 +2756,8 @@ ostree_repo_write_mtree (OstreeRepo *self,
}
else
{
gs_unref_hashtable GHashTable *dir_metadata_checksums = NULL;
gs_unref_hashtable GHashTable *dir_contents_checksums = NULL;
g_autoptr(GHashTable) dir_metadata_checksums = NULL;
g_autoptr(GHashTable) dir_contents_checksums = NULL;
gs_unref_variant GVariant *serialized_tree = NULL;
g_autofree guchar *contents_csum = NULL;
char contents_checksum_buf[65];

View File

@ -150,8 +150,8 @@ ostree_repo_prune (OstreeRepo *self,
gboolean ret = FALSE;
GHashTableIter hash_iter;
gpointer key, value;
gs_unref_hashtable GHashTable *objects = NULL;
gs_unref_hashtable GHashTable *all_refs = NULL;
g_autoptr(GHashTable) objects = NULL;
g_autoptr(GHashTable) all_refs = NULL;
OtPruneData data = { 0, };
gboolean refs_only = flags & OSTREE_REPO_PRUNE_FLAGS_REFS_ONLY;

View File

@ -1637,8 +1637,8 @@ ostree_repo_pull_with_options (OstreeRepo *self,
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;
g_autoptr(GHashTable) requested_refs_to_fetch = NULL;
g_autoptr(GHashTable) commits_to_fetch = NULL;
g_autofree char *remote_mode_str = NULL;
glnx_unref_object OstreeMetalink *metalink = NULL;
OtPullData pull_data_real = { 0, };

View File

@ -293,7 +293,7 @@ ostree_repo_resolve_partial_checksum (OstreeRepo *self,
gboolean ret = FALSE;
static const char hexchars[] = "0123456789abcdef";
gsize off;
gs_unref_hashtable GHashTable *ref_list = NULL;
g_autoptr(GHashTable) ref_list = NULL;
g_autofree char *ret_rev = NULL;
guint length;
const char *checksum = NULL;
@ -497,7 +497,7 @@ ostree_repo_list_refs (OstreeRepo *self,
GError **error)
{
gboolean ret = FALSE;
gs_unref_hashtable GHashTable *ret_all_refs = NULL;
g_autoptr(GHashTable) ret_all_refs = NULL;
g_autofree char *remote = NULL;
g_autofree char *ref_prefix = NULL;

View File

@ -155,7 +155,7 @@ build_content_sizenames_filtered (OstreeRepo *repo,
gboolean ret = FALSE;
gs_unref_ptrarray GPtrArray *ret_sizenames =
g_ptr_array_new_with_free_func (_ostree_delta_content_sizenames_free);
gs_unref_hashtable GHashTable *sizenames_map =
g_autoptr(GHashTable) sizenames_map =
g_hash_table_new_full (g_str_hash, g_str_equal, NULL, _ostree_delta_content_sizenames_free);
ostree_cleanup_repo_commit_traverse_iter
OstreeRepoCommitTraverseIter iter = { 0, };
@ -231,7 +231,7 @@ _ostree_delta_compute_similar_objects (OstreeRepo *repo,
GError **error)
{
gboolean ret = FALSE;
gs_unref_hashtable GHashTable *ret_modified_regfile_content =
g_autoptr(GHashTable) ret_modified_regfile_content =
g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify)g_ptr_array_unref);
gs_unref_ptrarray GPtrArray *from_sizes = NULL;
gs_unref_ptrarray GPtrArray *to_sizes = NULL;

View File

@ -504,8 +504,8 @@ try_content_bsdiff (OstreeRepo *repo,
GError **error)
{
gboolean ret = FALSE;
gs_unref_hashtable GHashTable *from_bsdiff = NULL;
gs_unref_hashtable GHashTable *to_bsdiff = NULL;
g_autoptr(GHashTable) from_bsdiff = NULL;
g_autoptr(GHashTable) to_bsdiff = NULL;
g_autoptr(GBytes) tmp_from = NULL;
g_autoptr(GBytes) tmp_to = NULL;
g_autoptr(GFileInfo) from_finfo = NULL;
@ -546,8 +546,8 @@ try_content_rollsum (OstreeRepo *repo,
GError **error)
{
gboolean ret = FALSE;
gs_unref_hashtable GHashTable *from_rollsum = NULL;
gs_unref_hashtable GHashTable *to_rollsum = NULL;
g_autoptr(GHashTable) from_rollsum = NULL;
g_autoptr(GHashTable) to_rollsum = NULL;
g_autoptr(GBytes) tmp_from = NULL;
g_autoptr(GBytes) tmp_to = NULL;
g_autoptr(GFileInfo) from_finfo = NULL;
@ -875,16 +875,16 @@ generate_delta_lowlatency (OstreeRepo *repo,
gs_unref_variant GVariant *from_commit = NULL;
g_autoptr(GFile) root_to = NULL;
gs_unref_variant GVariant *to_commit = NULL;
gs_unref_hashtable GHashTable *to_reachable_objects = NULL;
gs_unref_hashtable GHashTable *from_reachable_objects = NULL;
gs_unref_hashtable GHashTable *from_regfile_content = NULL;
gs_unref_hashtable GHashTable *new_reachable_metadata = NULL;
gs_unref_hashtable GHashTable *new_reachable_regfile_content = NULL;
gs_unref_hashtable GHashTable *new_reachable_symlink_content = NULL;
gs_unref_hashtable GHashTable *modified_regfile_content = NULL;
gs_unref_hashtable GHashTable *rollsum_optimized_content_objects = NULL;
gs_unref_hashtable GHashTable *bsdiff_optimized_content_objects = NULL;
gs_unref_hashtable GHashTable *content_object_to_size = NULL;
g_autoptr(GHashTable) to_reachable_objects = NULL;
g_autoptr(GHashTable) from_reachable_objects = NULL;
g_autoptr(GHashTable) from_regfile_content = NULL;
g_autoptr(GHashTable) new_reachable_metadata = NULL;
g_autoptr(GHashTable) new_reachable_regfile_content = NULL;
g_autoptr(GHashTable) new_reachable_symlink_content = NULL;
g_autoptr(GHashTable) modified_regfile_content = NULL;
g_autoptr(GHashTable) rollsum_optimized_content_objects = NULL;
g_autoptr(GHashTable) bsdiff_optimized_content_objects = NULL;
g_autoptr(GHashTable) content_object_to_size = NULL;
if (from != NULL)
{

View File

@ -496,7 +496,7 @@ ostree_repo_traverse_commit (OstreeRepo *repo,
GError **error)
{
gboolean ret = FALSE;
gs_unref_hashtable GHashTable *ret_reachable =
g_autoptr(GHashTable) ret_reachable =
ostree_repo_traverse_new_reachable ();
if (!ostree_repo_traverse_commit_union (repo, commit_checksum, maxdepth,

View File

@ -2726,7 +2726,7 @@ ostree_repo_list_objects (OstreeRepo *self,
GError **error)
{
gboolean ret = FALSE;
gs_unref_hashtable GHashTable *ret_objects = NULL;
g_autoptr(GHashTable) ret_objects = NULL;
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
g_return_val_if_fail (self->inited, FALSE);
@ -2781,7 +2781,7 @@ ostree_repo_list_commit_objects_starting_with (OstreeRepo *self
GError **error)
{
gboolean ret = FALSE;
gs_unref_hashtable GHashTable *ret_commits = NULL;
g_autoptr(GHashTable) ret_commits = NULL;
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
g_return_val_if_fail (self->inited, FALSE);
@ -3591,7 +3591,7 @@ ostree_repo_regenerate_summary (OstreeRepo *self,
GError **error)
{
gboolean ret = FALSE;
gs_unref_hashtable GHashTable *refs = NULL;
g_autoptr(GHashTable) refs = NULL;
gs_unref_variant_builder GVariantBuilder *refs_builder = NULL;
gs_unref_variant GVariant *summary = NULL;
GList *ordered_keys = NULL;

View File

@ -112,8 +112,8 @@ _ostree_compute_rollsum_matches (GBytes *from,
GBytes *to)
{
OstreeRollsumMatches *ret_rollsum = NULL;
gs_unref_hashtable GHashTable *from_rollsum = NULL;
gs_unref_hashtable GHashTable *to_rollsum = NULL;
g_autoptr(GHashTable) from_rollsum = NULL;
g_autoptr(GHashTable) to_rollsum = NULL;
gs_unref_ptrarray GPtrArray *matches = NULL;
const guint8 *from_buf;
gsize from_len;

View File

@ -294,8 +294,8 @@ cleanup_old_deployments (OstreeSysroot *self,
gboolean ret = FALSE;
struct stat root_stbuf;
guint i;
gs_unref_hashtable GHashTable *active_deployment_dirs = NULL;
gs_unref_hashtable GHashTable *active_boot_checksums = NULL;
g_autoptr(GHashTable) active_deployment_dirs = NULL;
g_autoptr(GHashTable) active_boot_checksums = NULL;
gs_unref_ptrarray GPtrArray *all_deployment_dirs = NULL;
gs_unref_ptrarray GPtrArray *all_boot_dirs = NULL;
@ -396,7 +396,7 @@ cleanup_ref_prefix (OstreeRepo *repo,
{
gboolean ret = FALSE;
g_autofree char *prefix = NULL;
gs_unref_hashtable GHashTable *refs = NULL;
g_autoptr(GHashTable) refs = NULL;
GHashTableIter hashiter;
gpointer hashkey, hashvalue;

View File

@ -1186,7 +1186,7 @@ install_deployment_kernel (OstreeSysroot *sysroot,
glnx_fd_close int deployment_dfd = -1;
g_autofree char *contents = NULL;
g_autofree char *deployment_version = NULL;
gs_unref_hashtable GHashTable *osrelease_values = NULL;
g_autoptr(GHashTable) osrelease_values = NULL;
g_autofree char *linux_relpath = NULL;
g_autofree char *linux_key = NULL;
g_autofree char *initramfs_relpath = NULL;
@ -1468,7 +1468,7 @@ cleanup_legacy_current_symlinks (OstreeSysroot *self,
{
gboolean ret = FALSE;
guint i;
gs_unref_hashtable GHashTable *created_current_for_osname =
g_autoptr(GHashTable) created_current_for_osname =
g_hash_table_new (g_str_hash, g_str_equal);
for (i = 0; i < self->deployments->len; i++)

View File

@ -95,7 +95,7 @@ parse_statoverride_file (GHashTable **out_mode_add,
gboolean ret = FALSE;
gsize len;
char **iter = NULL; /* nofree */
gs_unref_hashtable GHashTable *ret_hash = NULL;
g_autoptr(GHashTable) ret_hash = NULL;
g_autoptr(GFile) path = NULL;
g_autofree char *contents = NULL;
char **lines = NULL;
@ -303,7 +303,7 @@ ostree_builtin_commit (int argc, char **argv, GCancellable *cancellable, GError
gs_unref_variant GVariant *detached_metadata = NULL;
glnx_unref_object OstreeMutableTree *mtree = NULL;
g_autofree char *tree_type = NULL;
gs_unref_hashtable GHashTable *mode_adds = NULL;
g_autoptr(GHashTable) mode_adds = NULL;
OstreeRepoCommitModifierFlags flags = 0;
OstreeRepoCommitModifier *modifier = NULL;
OstreeRepoTransactionStats stats;

View File

@ -180,9 +180,9 @@ ostree_builtin_diff (int argc, char **argv, GCancellable *cancellable, GError **
if (opt_stats)
{
gs_unref_hashtable GHashTable *reachable_a = NULL;
gs_unref_hashtable GHashTable *reachable_b = NULL;
gs_unref_hashtable GHashTable *reachable_intersection = NULL;
g_autoptr(GHashTable) reachable_a = NULL;
g_autoptr(GHashTable) reachable_b = NULL;
g_autoptr(GHashTable) reachable_intersection = NULL;
g_autofree char *rev_a = NULL;
g_autofree char *rev_b = NULL;
g_autofree char *size = NULL;

View File

@ -185,7 +185,7 @@ fsck_reachable_objects_from_commits (OstreeRepo *repo,
gboolean ret = FALSE;
GHashTableIter hash_iter;
gpointer key, value;
gs_unref_hashtable GHashTable *reachable_objects = NULL;
g_autoptr(GHashTable) reachable_objects = NULL;
guint i;
guint mod;
guint count;
@ -244,8 +244,8 @@ ostree_builtin_fsck (int argc, char **argv, GCancellable *cancellable, GError **
gpointer key, value;
gboolean found_corruption = FALSE;
guint n_partial = 0;
gs_unref_hashtable GHashTable *objects = NULL;
gs_unref_hashtable GHashTable *commits = NULL;
g_autoptr(GHashTable) objects = NULL;
g_autoptr(GHashTable) commits = NULL;
context = g_option_context_new ("- Check the repository for consistency");

View File

@ -51,7 +51,7 @@ ostree_builtin_pull_local (int argc, char **argv, GCancellable *cancellable, GEr
g_autofree char *src_repo_uri = NULL;
glnx_unref_object OstreeAsyncProgress *progress = NULL;
gs_unref_ptrarray GPtrArray *refs_to_fetch = NULL;
gs_unref_hashtable GHashTable *source_objects = NULL;
g_autoptr(GHashTable) source_objects = NULL;
context = g_option_context_new ("SRC_REPO [REFS...] - Copy data from SRC_REPO");
@ -88,7 +88,7 @@ ostree_builtin_pull_local (int argc, char **argv, GCancellable *cancellable, GEr
{
g_autoptr(GFile) src_repo_path = g_file_new_for_path (src_repo_arg);
glnx_unref_object OstreeRepo *src_repo = ostree_repo_new (src_repo_path);
gs_unref_hashtable GHashTable *refs_to_clone = NULL;
g_autoptr(GHashTable) refs_to_clone = NULL;
refs_to_fetch = g_ptr_array_new_with_free_func (g_free);

View File

@ -41,7 +41,7 @@ ostree_builtin_refs (int argc, char **argv, GCancellable *cancellable, GError **
GOptionContext *context;
glnx_unref_object OstreeRepo *repo = NULL;
const char *refspec_prefix = NULL;
gs_unref_hashtable GHashTable *refs = NULL;
g_autoptr(GHashTable) refs = NULL;
GHashTableIter hashiter;
gpointer hashkey, hashvalue;

View File

@ -37,7 +37,7 @@ find_current_ref (OstreeRepo *repo,
GCancellable *cancellable,
GError **error)
{
gs_unref_hashtable GHashTable *refs = NULL;
g_autoptr(GHashTable) refs = NULL;
gchar *ret;
if (!ostree_repo_list_refs (repo, NULL, &refs, cancellable, error))