From ab1bc89ea851a568869b127befa6d5f8a97981ae Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Thu, 15 Nov 2018 15:04:35 +0000 Subject: [PATCH] trivial: Do a single query when getting a component by a set of GUIDs --- src/fu-engine.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/fu-engine.c b/src/fu-engine.c index 7409d2780..a1500f38f 100644 --- a/src/fu-engine.c +++ b/src/fu-engine.c @@ -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; }