diff options
author | Colin Walters <walters@verbum.org> | 2016-12-05 21:06:43 -0500 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2016-12-06 17:45:23 +0000 |
commit | 37965644ff37eb415cba1dfc952913da6d655813 (patch) | |
tree | 7c886f3af02a0ae86b894823e845c070e8a82c9b | |
parent | 247a8718bb699fdc6ae59e00b904f4bc9a2a401f (diff) | |
download | ostree-37965644ff37eb415cba1dfc952913da6d655813.tar.gz |
tree-wide: Use g_hash_table_add() where applicable
Just noticed a few while reading some code, decided to do a quick
cleanup. It's shorter and clearer.
Closes: #614
Approved by: jlebon
-rw-r--r-- | src/libostree/ostree-bootconfig-parser.c | 2 | ||||
-rw-r--r-- | src/libostree/ostree-repo-checkout.c | 2 | ||||
-rw-r--r-- | src/libostree/ostree-repo-pull.c | 14 | ||||
-rw-r--r-- | src/ostree/ot-builtin-fsck.c | 2 |
4 files changed, 10 insertions, 10 deletions
diff --git a/src/libostree/ostree-bootconfig-parser.c b/src/libostree/ostree-bootconfig-parser.c index a2ac1072..8031334e 100644 --- a/src/libostree/ostree-bootconfig-parser.c +++ b/src/libostree/ostree-bootconfig-parser.c @@ -193,7 +193,7 @@ ostree_bootconfig_parser_write_at (OstreeBootconfigParser *self, else { write_key (self, buf, key, value); - g_hash_table_insert (written_overrides, (gpointer)key, (gpointer)key); + g_hash_table_add (written_overrides, (gpointer)key); } } diff --git a/src/libostree/ostree-repo-checkout.c b/src/libostree/ostree-repo-checkout.c index 9b640648..9a151646 100644 --- a/src/libostree/ostree-repo-checkout.c +++ b/src/libostree/ostree-repo-checkout.c @@ -554,7 +554,7 @@ checkout_one_file_at (OstreeRepo *repo, g_ascii_xdigit_value (checksum[1])); if (repo->updated_uncompressed_dirs == NULL) repo->updated_uncompressed_dirs = g_hash_table_new (NULL, NULL); - g_hash_table_insert (repo->updated_uncompressed_dirs, key, key); + g_hash_table_add (repo->updated_uncompressed_dirs, key); } g_mutex_unlock (&repo->cache_lock); diff --git a/src/libostree/ostree-repo-pull.c b/src/libostree/ostree-repo-pull.c index 47da6846..b7197c38 100644 --- a/src/libostree/ostree-repo-pull.c +++ b/src/libostree/ostree-repo-pull.c @@ -522,7 +522,7 @@ scan_dirtree_object (OtPullData *pull_data, } else if (!file_is_stored && !g_hash_table_lookup (pull_data->requested_content, file_checksum)) { - g_hash_table_insert (pull_data->requested_content, file_checksum, file_checksum); + g_hash_table_add (pull_data->requested_content, file_checksum); enqueue_one_object_request (pull_data, file_checksum, OSTREE_OBJECT_TYPE_FILE, path, FALSE, FALSE); file_checksum = NULL; /* Transfer ownership */ } @@ -1292,7 +1292,7 @@ scan_one_metadata_object_c (OtPullData *pull_data, char *duped_checksum = g_strdup (tmp_checksum); gboolean do_fetch_detached; - g_hash_table_insert (pull_data->requested_metadata, duped_checksum, duped_checksum); + g_hash_table_add (pull_data->requested_metadata, duped_checksum); do_fetch_detached = (objtype == OSTREE_OBJECT_TYPE_COMMIT); enqueue_one_object_request (pull_data, tmp_checksum, objtype, path, do_fetch_detached, FALSE); @@ -1306,7 +1306,7 @@ scan_one_metadata_object_c (OtPullData *pull_data, pull_data->cancellable, error)) goto out; - g_hash_table_insert (pull_data->scanned_metadata, g_variant_ref (object), object); + g_hash_table_add (pull_data->scanned_metadata, g_variant_ref (object)); pull_data->n_scanned_metadata++; } else if (is_stored && objtype == OSTREE_OBJECT_TYPE_DIR_TREE) @@ -1315,7 +1315,7 @@ scan_one_metadata_object_c (OtPullData *pull_data, pull_data->cancellable, error)) goto out; - g_hash_table_insert (pull_data->scanned_metadata, g_variant_ref (object), object); + g_hash_table_add (pull_data->scanned_metadata, g_variant_ref (object)); pull_data->n_scanned_metadata++; } @@ -1536,7 +1536,7 @@ process_one_static_delta_fallback (OtPullData *pull_data, if (!g_hash_table_lookup (pull_data->requested_metadata, checksum)) { gboolean do_fetch_detached; - g_hash_table_insert (pull_data->requested_metadata, checksum, checksum); + g_hash_table_add (pull_data->requested_metadata, checksum); do_fetch_detached = (objtype == OSTREE_OBJECT_TYPE_COMMIT); enqueue_one_object_request (pull_data, checksum, objtype, NULL, do_fetch_detached, FALSE); @@ -1547,7 +1547,7 @@ process_one_static_delta_fallback (OtPullData *pull_data, { if (!g_hash_table_lookup (pull_data->requested_content, checksum)) { - g_hash_table_insert (pull_data->requested_content, checksum, checksum); + g_hash_table_add (pull_data->requested_content, checksum); enqueue_one_object_request (pull_data, checksum, OSTREE_OBJECT_TYPE_FILE, NULL, FALSE, FALSE); checksum = NULL; /* Transfer ownership */ } @@ -2836,7 +2836,7 @@ ostree_repo_pull_with_options (OstreeRepo *self, if (ostree_validate_checksum_string (branch, NULL)) { char *key = g_strdup (branch); - g_hash_table_insert (commits_to_fetch, key, key); + g_hash_table_add (commits_to_fetch, key); } else { diff --git a/src/ostree/ot-builtin-fsck.c b/src/ostree/ot-builtin-fsck.c index 9809ad29..090b44a0 100644 --- a/src/ostree/ot-builtin-fsck.c +++ b/src/ostree/ot-builtin-fsck.c @@ -311,7 +311,7 @@ ostree_builtin_fsck (int argc, char **argv, GCancellable *cancellable, GError ** if (commitstate & OSTREE_REPO_COMMIT_STATE_PARTIAL) n_partial++; else - g_hash_table_insert (commits, g_variant_ref (serialized_key), serialized_key); + g_hash_table_add (commits, g_variant_ref (serialized_key)); } } |