mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-06 16:25:34 +00:00
trivial: Do a single query when getting a component by a set of GUIDs
This commit is contained in:
parent
9cf352db2f
commit
ab1bc89ea8
@ -633,18 +633,18 @@ static XbNode *
|
||||
fu_engine_store_get_app_by_guids (XbSilo *silo, FuDevice *device)
|
||||
{
|
||||
GPtrArray *guids = fu_device_get_guids (device);
|
||||
g_autoptr(GString) xpath = g_string_new (NULL);
|
||||
g_autoptr(XbNode) component = NULL;
|
||||
for (guint i = 0; i < guids->len; i++) {
|
||||
g_autoptr(XbNode) component = NULL;
|
||||
g_autofree gchar *xpath = NULL;
|
||||
const gchar *guid = g_ptr_array_index (guids, i);
|
||||
xpath = g_strdup_printf ("components/component/"
|
||||
"provides/firmware[@type='flashed'][text()='%s']/"
|
||||
"../..",
|
||||
guid);
|
||||
component = xb_silo_query_first (silo, xpath, NULL);
|
||||
if (component != NULL)
|
||||
return g_steal_pointer (&component);
|
||||
xb_string_append_union (xpath,
|
||||
"components/component/"
|
||||
"provides/firmware[@type='flashed'][text()='%s']/"
|
||||
"../..", guid);
|
||||
}
|
||||
component = xb_silo_query_first (silo, xpath->str, NULL);
|
||||
if (component != NULL)
|
||||
return g_steal_pointer (&component);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user