traverse: Use g_hash_table_add

And "move semantics" via `g_steal_pointer()`.  Just a minor code
cleanup I noticed when I was hunting for a leak, which ended up being
elsewhere.

Closes: #598
Approved by: jlebon
This commit is contained in:
Colin Walters 2016-11-28 21:14:47 -05:00 committed by Atomic Bot
parent a1224e2de7
commit 3a459bac2d

View File

@ -349,8 +349,7 @@ traverse_iter (OstreeRepo *repo,
g_debug ("Found file object %s", checksum);
key = g_variant_ref_sink (ostree_object_name_serialize (checksum, OSTREE_OBJECT_TYPE_FILE));
g_hash_table_replace (inout_reachable, key, key);
key = NULL;
g_hash_table_add (inout_reachable, g_steal_pointer (&key));
}
else if (iterres == OSTREE_REPO_COMMIT_ITER_RESULT_DIR)
{
@ -364,14 +363,12 @@ traverse_iter (OstreeRepo *repo,
g_debug ("Found dirtree object %s", content_checksum);
g_debug ("Found dirmeta object %s", meta_checksum);
key = g_variant_ref_sink (ostree_object_name_serialize (meta_checksum, OSTREE_OBJECT_TYPE_DIR_META));
g_hash_table_replace (inout_reachable, key, key);
key = NULL;
g_hash_table_add (inout_reachable, g_steal_pointer (&key));
key = g_variant_ref_sink (ostree_object_name_serialize (content_checksum, OSTREE_OBJECT_TYPE_DIR_TREE));
if (!g_hash_table_lookup (inout_reachable, key))
{
g_hash_table_replace (inout_reachable, key, key);
key = NULL;
g_hash_table_add (inout_reachable, g_steal_pointer (&key));
if (!traverse_dirtree (repo, content_checksum, inout_reachable,
ignore_missing_dirs, cancellable, error))