From f4052b53f40d977752cf92452275283b35e5c47c Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Thu, 1 Oct 2020 13:47:14 +0100 Subject: [PATCH] trivial: Do not warn about the same missing remote more than once Removes 4 instances of 'ignoring unfound remote fwupd' at startup. --- src/fu-remote-list.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/fu-remote-list.c b/src/fu-remote-list.c index 68344d6b4..e9a24e8f2 100644 --- a/src/fu-remote-list.c +++ b/src/fu-remote-list.c @@ -34,6 +34,7 @@ struct _FuRemoteList GObject parent_instance; GPtrArray *array; /* (element-type FwupdRemote) */ GPtrArray *monitors; /* (element-type GFileMonitor) */ + GHashTable *hash_unfound; /* utf8 : NULL */ XbSilo *silo; }; @@ -296,6 +297,7 @@ static guint fu_remote_list_depsolve_with_direction (FuRemoteList *self, gint inc) { guint cnt = 0; + for (guint i = 0; i < self->array->len; i++) { FwupdRemote *remote = g_ptr_array_index (self->array, i); gchar **order = inc < 0 ? fwupd_remote_get_order_after (remote) : @@ -310,7 +312,11 @@ fu_remote_list_depsolve_with_direction (FuRemoteList *self, gint inc) } remote2 = fu_remote_list_get_by_id (self, order[j]); if (remote2 == NULL) { + if (g_hash_table_contains (self->hash_unfound, order[j])) + continue; g_debug ("ignoring unfound remote %s", order[j]); + g_hash_table_insert (self->hash_unfound, + g_strdup (order[j]), NULL); continue; } if (fwupd_remote_get_priority (remote) > fwupd_remote_get_priority (remote2)) @@ -487,6 +493,7 @@ fu_remote_list_init (FuRemoteList *self) { self->array = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref); self->monitors = g_ptr_array_new_with_free_func ((GDestroyNotify) fu_remote_list_monitor_unref); + self->hash_unfound = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); } static void @@ -497,6 +504,7 @@ fu_remote_list_finalize (GObject *obj) g_object_unref (self->silo); g_ptr_array_unref (self->array); g_ptr_array_unref (self->monitors); + g_hash_table_unref (self->hash_unfound); G_OBJECT_CLASS (fu_remote_list_parent_class)->finalize (obj); }