codebase: start using GLNX_HASH_TABLE_FOREACH macros
Use the new macros introduced recently in libglnx to make iterating over hash tables cleaner. This is just a start, it does not migrate the whole tree. Update submodule: libglnx Closes: #971 Approved by: cgwalters
This commit is contained in:
parent
ba918e49c5
commit
373dc4b66c
|
|
@ -48,15 +48,11 @@ OstreeBootconfigParser *
|
|||
ostree_bootconfig_parser_clone (OstreeBootconfigParser *self)
|
||||
{
|
||||
OstreeBootconfigParser *parser = ostree_bootconfig_parser_new ();
|
||||
guint i;
|
||||
GHashTableIter hashiter;
|
||||
gpointer k, v;
|
||||
|
||||
for (i = 0; i < self->lines->len; i++)
|
||||
for (guint i = 0; i < self->lines->len; i++)
|
||||
g_ptr_array_add (parser->lines, g_variant_ref (self->lines->pdata[i]));
|
||||
|
||||
g_hash_table_iter_init (&hashiter, self->options);
|
||||
while (g_hash_table_iter_next (&hashiter, &k, &v))
|
||||
GLNX_HASH_TABLE_FOREACH_KV (self->options, const char*, k, const char*, v)
|
||||
g_hash_table_replace (parser->options, g_strdup (k), g_strdup (v));
|
||||
|
||||
return parser;
|
||||
|
|
@ -183,14 +179,11 @@ ostree_bootconfig_parser_write_at (OstreeBootconfigParser *self,
|
|||
}
|
||||
}
|
||||
|
||||
GHashTableIter hashiter;
|
||||
gpointer hashkey, hashvalue;
|
||||
g_hash_table_iter_init (&hashiter, self->options);
|
||||
while (g_hash_table_iter_next (&hashiter, &hashkey, &hashvalue))
|
||||
GLNX_HASH_TABLE_FOREACH_KV (self->options, const char*, k, const char*, v)
|
||||
{
|
||||
if (g_hash_table_lookup (written_overrides, hashkey))
|
||||
if (g_hash_table_lookup (written_overrides, k))
|
||||
continue;
|
||||
write_key (self, buf, hashkey, hashvalue);
|
||||
write_key (self, buf, k, v);
|
||||
}
|
||||
|
||||
if (!glnx_file_replace_contents_at (dfd, path, (guint8*)buf->str, buf->len,
|
||||
|
|
|
|||
|
|
@ -690,9 +690,6 @@ static void
|
|||
adopt_steal_mainctx (OstreeFetcher *self,
|
||||
GMainContext *mainctx)
|
||||
{
|
||||
GHashTableIter hiter;
|
||||
gpointer key, value;
|
||||
|
||||
g_assert (self->mainctx == NULL);
|
||||
self->mainctx = mainctx; /* Transfer */
|
||||
|
||||
|
|
@ -706,12 +703,8 @@ adopt_steal_mainctx (OstreeFetcher *self,
|
|||
update_timeout_cb (self->multi, timeout_micros / 1000, self);
|
||||
}
|
||||
|
||||
g_hash_table_iter_init (&hiter, self->sockets);
|
||||
while (g_hash_table_iter_next (&hiter, &key, &value))
|
||||
{
|
||||
SockInfo *fdp = key;
|
||||
GLNX_HASH_TABLE_FOREACH (self->sockets, SockInfo*, fdp)
|
||||
setsock (fdp, fdp->sockfd, fdp->action, self);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -1323,24 +1323,18 @@ _ostree_fetcher_request_to_membuf_finish (OstreeFetcher *self,
|
|||
guint64
|
||||
_ostree_fetcher_bytes_transferred (OstreeFetcher *self)
|
||||
{
|
||||
GHashTableIter hiter;
|
||||
gpointer key, value;
|
||||
guint64 ret;
|
||||
|
||||
g_return_val_if_fail (OSTREE_IS_FETCHER (self), 0);
|
||||
|
||||
g_mutex_lock (&self->thread_closure->output_stream_set_lock);
|
||||
|
||||
ret = self->thread_closure->total_downloaded;
|
||||
guint64 ret = self->thread_closure->total_downloaded;
|
||||
|
||||
g_hash_table_iter_init (&hiter, self->thread_closure->output_stream_set);
|
||||
while (g_hash_table_iter_next (&hiter, &key, &value))
|
||||
GLNX_HASH_TABLE_FOREACH (self->thread_closure->output_stream_set,
|
||||
GFileOutputStream*, stream)
|
||||
{
|
||||
GFileOutputStream *stream = key;
|
||||
struct stat stbuf;
|
||||
|
||||
if (G_IS_FILE_DESCRIPTOR_BASED (stream))
|
||||
{
|
||||
struct stat stbuf;
|
||||
if (glnx_stream_fstat ((GFileDescriptorBased*)stream, &stbuf, NULL))
|
||||
ret += stbuf.st_size;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,9 +114,6 @@ ostree_mutable_tree_set_contents_checksum (OstreeMutableTree *self,
|
|||
const char *
|
||||
ostree_mutable_tree_get_contents_checksum (OstreeMutableTree *self)
|
||||
{
|
||||
GHashTableIter iter;
|
||||
gpointer key, value;
|
||||
|
||||
if (!self->contents_checksum)
|
||||
return NULL;
|
||||
|
||||
|
|
@ -127,10 +124,8 @@ ostree_mutable_tree_get_contents_checksum (OstreeMutableTree *self)
|
|||
*
|
||||
* However, we only call this function once right now.
|
||||
*/
|
||||
g_hash_table_iter_init (&iter, self->subdirs);
|
||||
while (g_hash_table_iter_next (&iter, &key, &value))
|
||||
GLNX_HASH_TABLE_FOREACH_V (self->subdirs, OstreeMutableTree*, subdir)
|
||||
{
|
||||
OstreeMutableTree *subdir = value;
|
||||
if (!ostree_mutable_tree_get_contents_checksum (subdir))
|
||||
{
|
||||
g_free (self->contents_checksum);
|
||||
|
|
|
|||
|
|
@ -1088,13 +1088,12 @@ ostree_repo_checkout_gc (OstreeRepo *self,
|
|||
self->updated_uncompressed_dirs = g_hash_table_new (NULL, NULL);
|
||||
g_mutex_unlock (&self->cache_lock);
|
||||
|
||||
GHashTableIter iter;
|
||||
gpointer key, value;
|
||||
if (to_clean_dirs)
|
||||
g_hash_table_iter_init (&iter, to_clean_dirs);
|
||||
while (to_clean_dirs && g_hash_table_iter_next (&iter, &key, &value))
|
||||
if (!to_clean_dirs)
|
||||
return TRUE; /* Note early return */
|
||||
|
||||
GLNX_HASH_TABLE_FOREACH (to_clean_dirs, guint, prefix)
|
||||
{
|
||||
g_autofree char *objdir_name = g_strdup_printf ("%02x", GPOINTER_TO_UINT (key));
|
||||
g_autofree char *objdir_name = g_strdup_printf ("%02x", prefix);
|
||||
g_auto(GLnxDirFdIterator) dfd_iter = { 0, };
|
||||
|
||||
if (!glnx_dirfd_iterator_init_at (self->uncompressed_objects_dir_fd, objdir_name, FALSE,
|
||||
|
|
|
|||
|
|
@ -369,26 +369,17 @@ add_size_index_to_metadata (OstreeRepo *self,
|
|||
if (self->object_sizes &&
|
||||
g_hash_table_size (self->object_sizes) > 0)
|
||||
{
|
||||
GHashTableIter entries = { 0 };
|
||||
gchar *e_checksum = NULL;
|
||||
OstreeContentSizeCacheEntry *e_size = NULL;
|
||||
GVariantBuilder index_builder;
|
||||
guint i;
|
||||
g_autoptr(GPtrArray) sorted_keys = NULL;
|
||||
|
||||
g_hash_table_iter_init (&entries, self->object_sizes);
|
||||
g_variant_builder_init (&index_builder,
|
||||
G_VARIANT_TYPE ("a" _OSTREE_OBJECT_SIZES_ENTRY_SIGNATURE));
|
||||
|
||||
/* Sort the checksums so we can bsearch if desired */
|
||||
sorted_keys = g_ptr_array_new ();
|
||||
while (g_hash_table_iter_next (&entries,
|
||||
(gpointer *) &e_checksum,
|
||||
(gpointer *) &e_size))
|
||||
g_ptr_array_add (sorted_keys, e_checksum);
|
||||
g_autoptr(GPtrArray) sorted_keys = g_ptr_array_new ();
|
||||
GLNX_HASH_TABLE_FOREACH (self->object_sizes, const char*, e_checksum)
|
||||
g_ptr_array_add (sorted_keys, (gpointer)e_checksum);
|
||||
g_ptr_array_sort (sorted_keys, compare_ascii_checksums_for_sorting);
|
||||
|
||||
for (i = 0; i < sorted_keys->len; i++)
|
||||
for (guint i = 0; i < sorted_keys->len; i++)
|
||||
{
|
||||
guint8 csum[OSTREE_SHA256_DIGEST_LEN];
|
||||
const char *e_checksum = sorted_keys->pdata[i];
|
||||
|
|
@ -397,7 +388,8 @@ add_size_index_to_metadata (OstreeRepo *self,
|
|||
ostree_checksum_inplace_to_bytes (e_checksum, csum);
|
||||
g_string_append_len (buffer, (char*)csum, sizeof (csum));
|
||||
|
||||
e_size = g_hash_table_lookup (self->object_sizes, e_checksum);
|
||||
OstreeContentSizeCacheEntry *e_size =
|
||||
g_hash_table_lookup (self->object_sizes, e_checksum);
|
||||
_ostree_write_varuint64 (buffer, e_size->archived);
|
||||
_ostree_write_varuint64 (buffer, e_size->unpacked);
|
||||
|
||||
|
|
@ -2234,8 +2226,6 @@ create_tree_variant_from_hashes (GHashTable *file_checksums,
|
|||
GHashTable *dir_contents_checksums,
|
||||
GHashTable *dir_metadata_checksums)
|
||||
{
|
||||
GHashTableIter hash_iter;
|
||||
gpointer key, value;
|
||||
GVariantBuilder files_builder;
|
||||
GVariantBuilder dirs_builder;
|
||||
GSList *sorted_filenames = NULL;
|
||||
|
|
@ -2245,11 +2235,8 @@ create_tree_variant_from_hashes (GHashTable *file_checksums,
|
|||
g_variant_builder_init (&files_builder, G_VARIANT_TYPE ("a(say)"));
|
||||
g_variant_builder_init (&dirs_builder, G_VARIANT_TYPE ("a(sayay)"));
|
||||
|
||||
g_hash_table_iter_init (&hash_iter, file_checksums);
|
||||
while (g_hash_table_iter_next (&hash_iter, &key, &value))
|
||||
GLNX_HASH_TABLE_FOREACH (file_checksums, const char*, name)
|
||||
{
|
||||
const char *name = key;
|
||||
|
||||
/* Should have been validated earlier, but be paranoid */
|
||||
g_assert (ot_util_filename_validate (name, NULL));
|
||||
|
||||
|
|
@ -2270,13 +2257,8 @@ create_tree_variant_from_hashes (GHashTable *file_checksums,
|
|||
|
||||
g_slist_free (sorted_filenames);
|
||||
sorted_filenames = NULL;
|
||||
|
||||
g_hash_table_iter_init (&hash_iter, dir_metadata_checksums);
|
||||
while (g_hash_table_iter_next (&hash_iter, &key, &value))
|
||||
{
|
||||
const char *name = key;
|
||||
GLNX_HASH_TABLE_FOREACH (dir_metadata_checksums, const char*, name)
|
||||
sorted_filenames = g_slist_prepend (sorted_filenames, (char*)name);
|
||||
}
|
||||
|
||||
sorted_filenames = g_slist_sort (sorted_filenames, (GCompareFunc)strcmp);
|
||||
|
||||
|
|
@ -2993,15 +2975,10 @@ ostree_repo_write_mtree (OstreeRepo *self,
|
|||
dir_metadata_checksums = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||
(GDestroyNotify)g_free, (GDestroyNotify)g_free);
|
||||
|
||||
GHashTableIter hash_iter;
|
||||
gpointer key, value;
|
||||
g_hash_table_iter_init (&hash_iter, ostree_mutable_tree_get_subdirs (mtree));
|
||||
while (g_hash_table_iter_next (&hash_iter, &key, &value))
|
||||
GLNX_HASH_TABLE_FOREACH_KV (ostree_mutable_tree_get_subdirs (mtree),
|
||||
const char*, name, OstreeMutableTree*, child_dir)
|
||||
{
|
||||
const char *name = key;
|
||||
g_autoptr(GFile) child_file = NULL;
|
||||
OstreeMutableTree *child_dir = value;
|
||||
|
||||
if (!ostree_repo_write_mtree (self, child_dir, &child_file,
|
||||
cancellable, error))
|
||||
return FALSE;
|
||||
|
|
|
|||
|
|
@ -773,14 +773,11 @@ aic_import_deferred_hardlinks (OstreeRepoArchiveImportContext *ctx,
|
|||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
GHashTableIter iter;
|
||||
gpointer key, value;
|
||||
|
||||
g_hash_table_iter_init (&iter, ctx->deferred_hardlinks);
|
||||
while (g_hash_table_iter_next (&iter, &key, &value))
|
||||
if (!aic_import_deferred_hardlinks_for (ctx, key, value, error))
|
||||
GLNX_HASH_TABLE_FOREACH_KV (ctx->deferred_hardlinks, const char*, target, GSList*, links)
|
||||
{
|
||||
if (!aic_import_deferred_hardlinks_for (ctx, target, links, error))
|
||||
return FALSE;
|
||||
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -232,8 +232,6 @@ repo_prune_internal (OstreeRepo *self,
|
|||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
GHashTableIter hash_iter;
|
||||
gpointer key, value;
|
||||
OtPruneData data = { 0, };
|
||||
|
||||
data.repo = self;
|
||||
|
|
@ -241,11 +239,8 @@ repo_prune_internal (OstreeRepo *self,
|
|||
g_autoptr(GHashTable) reachable_owned = g_hash_table_ref (options->reachable);
|
||||
data.reachable = reachable_owned;
|
||||
|
||||
g_hash_table_iter_init (&hash_iter, objects);
|
||||
while (g_hash_table_iter_next (&hash_iter, &key, &value))
|
||||
GLNX_HASH_TABLE_FOREACH_KV (objects, GVariant*, serialized_key, GVariant*, objdata)
|
||||
{
|
||||
GVariant *serialized_key = key;
|
||||
GVariant *objdata = value;
|
||||
const char *checksum;
|
||||
OstreeObjectType objtype;
|
||||
gboolean is_loose;
|
||||
|
|
@ -309,13 +304,10 @@ ostree_repo_prune (OstreeRepo *self,
|
|||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
GHashTableIter hash_iter;
|
||||
gpointer key, value;
|
||||
g_autoptr(GHashTable) objects = NULL;
|
||||
g_autoptr(GHashTable) reachable = NULL;
|
||||
gboolean refs_only = flags & OSTREE_REPO_PRUNE_FLAGS_REFS_ONLY;
|
||||
|
||||
reachable = ostree_repo_traverse_new_reachable ();
|
||||
g_autoptr(GHashTable) reachable = ostree_repo_traverse_new_reachable ();
|
||||
|
||||
/* This original prune API has fixed logic for traversing refs or all commits
|
||||
* combined with actually deleting content. The newer backend API just does
|
||||
|
|
@ -331,12 +323,8 @@ ostree_repo_prune (OstreeRepo *self,
|
|||
cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
g_hash_table_iter_init (&hash_iter, all_refs);
|
||||
|
||||
while (g_hash_table_iter_next (&hash_iter, &key, &value))
|
||||
GLNX_HASH_TABLE_FOREACH_V (all_refs, const char*, checksum)
|
||||
{
|
||||
const char *checksum = value;
|
||||
|
||||
g_debug ("Finding objects to keep for commit %s", checksum);
|
||||
if (!ostree_repo_traverse_commit_union (self, checksum, depth, reachable,
|
||||
cancellable, error))
|
||||
|
|
@ -350,12 +338,8 @@ ostree_repo_prune (OstreeRepo *self,
|
|||
cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
g_hash_table_iter_init (&hash_iter, all_collection_refs);
|
||||
|
||||
while (g_hash_table_iter_next (&hash_iter, &key, &value))
|
||||
GLNX_HASH_TABLE_FOREACH_V (all_collection_refs, const char*, checksum)
|
||||
{
|
||||
const char *checksum = value;
|
||||
|
||||
g_debug ("Finding objects to keep for commit %s", checksum);
|
||||
if (!ostree_repo_traverse_commit_union (self, checksum, depth, reachable,
|
||||
cancellable, error))
|
||||
|
|
@ -369,10 +353,8 @@ ostree_repo_prune (OstreeRepo *self,
|
|||
|
||||
if (!refs_only)
|
||||
{
|
||||
g_hash_table_iter_init (&hash_iter, objects);
|
||||
while (g_hash_table_iter_next (&hash_iter, &key, &value))
|
||||
GLNX_HASH_TABLE_FOREACH (objects, GVariant*, serialized_key)
|
||||
{
|
||||
GVariant *serialized_key = key;
|
||||
const char *checksum;
|
||||
OstreeObjectType objtype;
|
||||
|
||||
|
|
|
|||
|
|
@ -2023,23 +2023,19 @@ get_best_static_delta_start_for (OtPullData *pull_data,
|
|||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
GHashTableIter hiter;
|
||||
gpointer hkey, hvalue;
|
||||
/* Array<char*> of possible from checksums */
|
||||
g_autoptr(GPtrArray) candidates = g_ptr_array_new_with_free_func (g_free);
|
||||
const char *newest_candidate = NULL;
|
||||
guint64 newest_candidate_timestamp = 0;
|
||||
|
||||
g_assert (pull_data->summary_deltas_checksums != NULL);
|
||||
g_hash_table_iter_init (&hiter, pull_data->summary_deltas_checksums);
|
||||
|
||||
*out_have_scratch_delta = FALSE;
|
||||
|
||||
/* Loop over all deltas known from the summary file,
|
||||
* finding ones which go to to_revision */
|
||||
while (g_hash_table_iter_next (&hiter, &hkey, &hvalue))
|
||||
GLNX_HASH_TABLE_FOREACH (pull_data->summary_deltas_checksums, const char*, delta_name)
|
||||
{
|
||||
const char *delta_name = hkey;
|
||||
g_autofree char *cur_from_rev = NULL;
|
||||
g_autofree char *cur_to_rev = NULL;
|
||||
|
||||
|
|
@ -2893,8 +2889,6 @@ ostree_repo_pull_with_options (OstreeRepo *self,
|
|||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GHashTableIter hash_iter;
|
||||
gpointer key, value;
|
||||
g_autoptr(GBytes) bytes_summary = NULL;
|
||||
g_autofree char *metalink_url_str = NULL;
|
||||
g_autoptr(GHashTable) requested_refs_to_fetch = NULL; /* (element-type OstreeCollectionRef utf8) */
|
||||
|
|
@ -3539,15 +3533,13 @@ ostree_repo_pull_with_options (OstreeRepo *self,
|
|||
/* Resolve the checksum for each ref. This has to be done into a new hash table,
|
||||
* since we can’t modify the keys of @requested_refs_to_fetch while iterating
|
||||
* over it, and we need to ensure the collection IDs are resolved too. */
|
||||
g_hash_table_iter_init (&hash_iter, requested_refs_to_fetch);
|
||||
updated_requested_refs_to_fetch = g_hash_table_new_full (ostree_collection_ref_hash,
|
||||
ostree_collection_ref_equal,
|
||||
(GDestroyNotify) ostree_collection_ref_free,
|
||||
g_free);
|
||||
while (g_hash_table_iter_next (&hash_iter, &key, &value))
|
||||
GLNX_HASH_TABLE_FOREACH_KV (requested_refs_to_fetch, const OstreeCollectionRef*, ref,
|
||||
const char*, override_commitid)
|
||||
{
|
||||
const OstreeCollectionRef *ref = key;
|
||||
const char *override_commitid = value;
|
||||
g_autofree char *contents = NULL;
|
||||
|
||||
/* Support specifying "" for an override commitid */
|
||||
|
|
@ -3621,20 +3613,16 @@ ostree_repo_pull_with_options (OstreeRepo *self,
|
|||
g_debug ("resuming legacy transaction");
|
||||
|
||||
/* Initiate requests for explicit commit revisions */
|
||||
g_hash_table_iter_init (&hash_iter, commits_to_fetch);
|
||||
while (g_hash_table_iter_next (&hash_iter, &key, &value))
|
||||
GLNX_HASH_TABLE_FOREACH_V (commits_to_fetch, const char*, commit)
|
||||
{
|
||||
const char *commit = value;
|
||||
if (!initiate_request (pull_data, NULL, commit, error))
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Initiate requests for refs */
|
||||
g_hash_table_iter_init (&hash_iter, requested_refs_to_fetch);
|
||||
while (g_hash_table_iter_next (&hash_iter, &key, &value))
|
||||
GLNX_HASH_TABLE_FOREACH_KV (requested_refs_to_fetch, const OstreeCollectionRef*, ref,
|
||||
const char*, to_revision)
|
||||
{
|
||||
const OstreeCollectionRef *ref = key;
|
||||
const char *to_revision = value;
|
||||
if (!initiate_request (pull_data, ref, to_revision, error))
|
||||
goto out;
|
||||
}
|
||||
|
|
@ -3671,11 +3659,9 @@ ostree_repo_pull_with_options (OstreeRepo *self,
|
|||
g_assert_cmpint (pull_data->n_outstanding_content_fetches, ==, 0);
|
||||
g_assert_cmpint (pull_data->n_outstanding_content_write_requests, ==, 0);
|
||||
|
||||
g_hash_table_iter_init (&hash_iter, requested_refs_to_fetch);
|
||||
while (g_hash_table_iter_next (&hash_iter, &key, &value))
|
||||
GLNX_HASH_TABLE_FOREACH_KV (requested_refs_to_fetch, const OstreeCollectionRef*, ref,
|
||||
const char*, checksum)
|
||||
{
|
||||
const OstreeCollectionRef *ref = key;
|
||||
const char *checksum = value;
|
||||
g_autofree char *remote_ref = NULL;
|
||||
g_autofree char *original_rev = NULL;
|
||||
|
||||
|
|
@ -3762,22 +3748,16 @@ ostree_repo_pull_with_options (OstreeRepo *self,
|
|||
/* iterate over commits fetched and delete any commitpartial files */
|
||||
if (pull_data->dirs == NULL && !pull_data->is_commit_only)
|
||||
{
|
||||
g_hash_table_iter_init (&hash_iter, requested_refs_to_fetch);
|
||||
while (g_hash_table_iter_next (&hash_iter, &key, &value))
|
||||
GLNX_HASH_TABLE_FOREACH_V (requested_refs_to_fetch, const char*, checksum)
|
||||
{
|
||||
const char *checksum = value;
|
||||
g_autofree char *commitpartial_path = _ostree_get_commitpartial_path (checksum);
|
||||
|
||||
if (!ot_ensure_unlinked_at (pull_data->repo->repo_dir_fd, commitpartial_path, 0))
|
||||
goto out;
|
||||
}
|
||||
|
||||
g_hash_table_iter_init (&hash_iter, commits_to_fetch);
|
||||
while (g_hash_table_iter_next (&hash_iter, &key, &value))
|
||||
GLNX_HASH_TABLE_FOREACH_V (commits_to_fetch, const char*, commit)
|
||||
{
|
||||
const char *commit = value;
|
||||
g_autofree char *commitpartial_path = _ostree_get_commitpartial_path (commit);
|
||||
|
||||
if (!ot_ensure_unlinked_at (pull_data->repo->repo_dir_fd, commitpartial_path, 0))
|
||||
goto out;
|
||||
}
|
||||
|
|
@ -4326,18 +4306,16 @@ find_remotes_cb (GObject *obj,
|
|||
GCancellable *cancellable;
|
||||
const FindRemotesData *data;
|
||||
const OstreeCollectionRef * const *refs;
|
||||
OstreeAsyncProgress *progress;
|
||||
/* FIXME: We currently do nothing with @progress. Comment out to assuage -Wunused-variable */
|
||||
/* OstreeAsyncProgress *progress; */
|
||||
g_autoptr(GError) error = NULL;
|
||||
g_autoptr(GPtrArray) results = NULL; /* (element-type OstreeRepoFinderResult) */
|
||||
gsize i;
|
||||
GHashTableIter iter;
|
||||
CommitMetadata *commit_metadata;
|
||||
g_autoptr(PointerTable) refs_and_remotes_table = NULL; /* (element-type commit-checksum) */
|
||||
g_autoptr(GHashTable) commit_metadatas = NULL; /* (element-type commit-checksum CommitMetadata) */
|
||||
g_autoptr(OstreeFetcher) fetcher = NULL;
|
||||
g_autofree const gchar **ref_to_latest_commit = NULL; /* indexed as @refs; (element-type commit-checksum) */
|
||||
gsize n_refs;
|
||||
const gchar *checksum;
|
||||
g_autoptr(GPtrArray) remotes_to_remove = NULL; /* (element-type OstreeRemote) */
|
||||
g_autoptr(GPtrArray) final_results = NULL; /* (element-type OstreeRepoFinderResult) */
|
||||
|
||||
|
|
@ -4347,7 +4325,7 @@ find_remotes_cb (GObject *obj,
|
|||
data = g_task_get_task_data (task);
|
||||
|
||||
refs = (const OstreeCollectionRef * const *) data->refs;
|
||||
progress = data->progress;
|
||||
/* progress = data->progress; */
|
||||
|
||||
/* Finish finding the remotes. */
|
||||
results = ostree_repo_finder_resolve_all_finish (result, &error);
|
||||
|
|
@ -4383,8 +4361,6 @@ find_remotes_cb (GObject *obj,
|
|||
* estimation for the actual pull operation. This should check the
|
||||
* disable-static-deltas option first. */
|
||||
|
||||
/* FIXME: We currently do nothing with @progress. */
|
||||
|
||||
/* Each key must be a pointer to the #CommitMetadata.checksum field of its value. */
|
||||
commit_metadatas = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, (GDestroyNotify) commit_metadata_free);
|
||||
|
||||
|
|
@ -4496,9 +4472,7 @@ find_remotes_cb (GObject *obj,
|
|||
* the commit metadata from the remotes. The ‘most recent commits’ are the
|
||||
* set of head commits pointed to by the refs we just resolved from the
|
||||
* summary files. */
|
||||
g_hash_table_iter_init (&iter, commit_metadatas);
|
||||
|
||||
while (g_hash_table_iter_next (&iter, (gpointer *) &checksum, (gpointer *) &commit_metadata))
|
||||
GLNX_HASH_TABLE_FOREACH_V (commit_metadatas, CommitMetadata*, commit_metadata)
|
||||
{
|
||||
char buf[_OSTREE_LOOSE_PATH_MAX];
|
||||
g_autofree gchar *commit_filename = NULL;
|
||||
|
|
@ -4853,9 +4827,6 @@ ostree_repo_pull_from_remotes_async (OstreeRepo *self,
|
|||
g_autoptr(GHashTable) refs_pulled = NULL; /* (element-type OstreeCollectionRef gboolean) */
|
||||
gsize i, j;
|
||||
g_autoptr(GString) refs_unpulled_string = NULL;
|
||||
GHashTableIter iter;
|
||||
const OstreeCollectionRef *ref;
|
||||
gpointer is_pulled_pointer;
|
||||
g_autoptr(GError) local_error = NULL;
|
||||
g_auto(GVariantDict) options_dict = OT_VARIANT_BUILDER_INITIALIZER;
|
||||
OstreeRepoPullFlags flags;
|
||||
|
|
@ -4900,16 +4871,14 @@ ostree_repo_pull_from_remotes_async (OstreeRepo *self,
|
|||
g_auto(GVariantBuilder) refs_to_pull_builder = OT_VARIANT_BUILDER_INITIALIZER;
|
||||
g_auto(GVariantDict) local_options_dict = OT_VARIANT_BUILDER_INITIALIZER;
|
||||
g_autoptr(GVariant) local_options = NULL;
|
||||
const gchar *checksum;
|
||||
gboolean remove_remote;
|
||||
|
||||
refs_to_pull = g_ptr_array_new_with_free_func (NULL);
|
||||
refs_to_pull_str = g_string_new ("");
|
||||
g_variant_builder_init (&refs_to_pull_builder, G_VARIANT_TYPE ("a(sss)"));
|
||||
|
||||
g_hash_table_iter_init (&iter, result->ref_to_checksum);
|
||||
|
||||
while (g_hash_table_iter_next (&iter, (gpointer *) &ref, (gpointer *) &checksum))
|
||||
GLNX_HASH_TABLE_FOREACH_KV (result->ref_to_checksum, const OstreeCollectionRef*, ref,
|
||||
const char*, checksum)
|
||||
{
|
||||
if (checksum != NULL &&
|
||||
!GPOINTER_TO_INT (g_hash_table_lookup (refs_pulled, ref)))
|
||||
|
|
@ -4996,12 +4965,9 @@ ostree_repo_pull_from_remotes_async (OstreeRepo *self,
|
|||
}
|
||||
|
||||
/* Any refs left un-downloaded? If so, we’ve failed. */
|
||||
g_hash_table_iter_init (&iter, refs_pulled);
|
||||
|
||||
while (g_hash_table_iter_next (&iter, (gpointer *) &ref, (gpointer *) &is_pulled_pointer))
|
||||
GLNX_HASH_TABLE_FOREACH_KV (refs_pulled, const OstreeCollectionRef*, ref,
|
||||
gboolean, is_pulled)
|
||||
{
|
||||
gboolean is_pulled = GPOINTER_TO_INT (is_pulled_pointer);
|
||||
|
||||
if (is_pulled)
|
||||
continue;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue