mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-08 01:14:43 +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)
|
fu_engine_store_get_app_by_guids (XbSilo *silo, FuDevice *device)
|
||||||
{
|
{
|
||||||
GPtrArray *guids = fu_device_get_guids (device);
|
GPtrArray *guids = fu_device_get_guids (device);
|
||||||
for (guint i = 0; i < guids->len; i++) {
|
g_autoptr(GString) xpath = g_string_new (NULL);
|
||||||
g_autoptr(XbNode) component = NULL;
|
g_autoptr(XbNode) component = NULL;
|
||||||
g_autofree gchar *xpath = NULL;
|
for (guint i = 0; i < guids->len; i++) {
|
||||||
const gchar *guid = g_ptr_array_index (guids, i);
|
const gchar *guid = g_ptr_array_index (guids, i);
|
||||||
xpath = g_strdup_printf ("components/component/"
|
xb_string_append_union (xpath,
|
||||||
|
"components/component/"
|
||||||
"provides/firmware[@type='flashed'][text()='%s']/"
|
"provides/firmware[@type='flashed'][text()='%s']/"
|
||||||
"../..",
|
"../..", guid);
|
||||||
guid);
|
}
|
||||||
component = xb_silo_query_first (silo, xpath, NULL);
|
component = xb_silo_query_first (silo, xpath->str, NULL);
|
||||||
if (component != NULL)
|
if (component != NULL)
|
||||||
return g_steal_pointer (&component);
|
return g_steal_pointer (&component);
|
||||||
}
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user