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,16 +115,18 @@ fu_plugin_list_add(FuPluginList *self, FuPlugin *plugin)
|
|||||||
FuPlugin *
|
FuPlugin *
|
||||||
fu_plugin_list_find_by_name(FuPluginList *self, const gchar *name, GError **error)
|
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(FU_IS_PLUGIN_LIST(self), NULL);
|
||||||
g_return_val_if_fail(name != NULL, NULL);
|
g_return_val_if_fail(name != NULL, NULL);
|
||||||
g_return_val_if_fail(error == NULL || *error == 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);
|
plugin = g_hash_table_lookup(self->plugins_hash, name);
|
||||||
if (g_strcmp0(fu_plugin_get_name(plugin), name) == 0)
|
if (plugin == NULL) {
|
||||||
return plugin;
|
g_set_error(error, FWUPD_ERROR, FWUPD_ERROR_NOT_FOUND, "no plugin %s found", name);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
g_set_error(error, FWUPD_ERROR, FWUPD_ERROR_NOT_FOUND, "no plugin %s found", name);
|
return plugin;
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
|
Loading…
Reference in New Issue
Block a user