mirror of
https://git.proxmox.com/git/fwupd
synced 2025-07-27 11:09:28 +00:00
Speed up daemon startup by ~2%
We populate the plugin name hash table, but we forgot to use it.
This commit is contained in:
parent
5e895b89c9
commit
eef0e079ab
@ -115,17 +115,19 @@ fu_plugin_list_add(FuPluginList *self, FuPlugin *plugin)
|
||||
FuPlugin *
|
||||
fu_plugin_list_find_by_name(FuPluginList *self, const gchar *name, GError **error)
|
||||
{
|
||||
FuPlugin *plugin;
|
||||
|
||||
g_return_val_if_fail(FU_IS_PLUGIN_LIST(self), NULL);
|
||||
g_return_val_if_fail(name != NULL, NULL);
|
||||
g_return_val_if_fail(error == NULL || *error == NULL, NULL);
|
||||
for (guint i = 0; i < self->plugins->len; i++) {
|
||||
FuPlugin *plugin = g_ptr_array_index(self->plugins, i);
|
||||
if (g_strcmp0(fu_plugin_get_name(plugin), name) == 0)
|
||||
return plugin;
|
||||
}
|
||||
|
||||
plugin = g_hash_table_lookup(self->plugins_hash, name);
|
||||
if (plugin == NULL) {
|
||||
g_set_error(error, FWUPD_ERROR, FWUPD_ERROR_NOT_FOUND, "no plugin %s found", name);
|
||||
return NULL;
|
||||
}
|
||||
return plugin;
|
||||
}
|
||||
|
||||
static gint
|
||||
fu_plugin_list_sort_cb(gconstpointer a, gconstpointer b)
|
||||
|
Loading…
Reference in New Issue
Block a user