[gnome-software] gs-plugin-loader: Avoid calls to refine_wildcard()
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] gs-plugin-loader: Avoid calls to refine_wildcard()
- Date: Thu, 14 May 2020 17:34:04 +0000 (UTC)
commit 45505197d6fe5781ed66ba9968f2fc179d4df293
Author: Philip Withnall <withnall endlessm com>
Date: Thu Apr 2 13:06:18 2020 +0100
gs-plugin-loader: Avoid calls to refine_wildcard()
If a plugin doesn’t support `gs_plugin_refine_wildcard()`, there’s
no need to call `call_vfunc()` for each app in a list of (likely a
few hundred) apps for it to immediately return TRUE each time.
Signed-off-by: Philip Withnall <withnall endlessm com>
lib/gs-plugin-loader.c | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
---
diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c
index fef08423..8ab51db5 100644
--- a/lib/gs-plugin-loader.c
+++ b/lib/gs-plugin-loader.c
@@ -790,20 +790,24 @@ gs_plugin_loader_run_refine_filter (GsPluginLoaderHelper *helper,
return FALSE;
}
- /* use a copy of the list for the loop because a function called
- * on the plugin may affect the list which can lead to problems
- * (e.g. inserting an app in the list on every call results in
- * an infinite loop) */
- helper->function_name = "gs_plugin_refine_wildcard";
- app_list = gs_app_list_copy (list);
- for (guint j = 0; j < gs_app_list_length (app_list); j++) {
- GsApp *app = gs_app_list_index (app_list, j);
- if (gs_app_has_quirk (app, GS_APP_QUIRK_IS_WILDCARD) &&
- !gs_plugin_loader_call_vfunc (helper, plugin, app, NULL,
- refine_flags, cancellable, error)) {
- return FALSE;
+ if (gs_plugin_get_symbol (plugin, "gs_plugin_refine_wildcard") != NULL) {
+ /* use a copy of the list for the loop because a function called
+ * on the plugin may affect the list which can lead to problems
+ * (e.g. inserting an app in the list on every call results in
+ * an infinite loop) */
+ app_list = gs_app_list_copy (list);
+ helper->function_name = "gs_plugin_refine_wildcard";
+
+ for (guint j = 0; j < gs_app_list_length (app_list); j++) {
+ GsApp *app = gs_app_list_index (app_list, j);
+ if (gs_app_has_quirk (app, GS_APP_QUIRK_IS_WILDCARD) &&
+ !gs_plugin_loader_call_vfunc (helper, plugin, app, NULL,
+ refine_flags, cancellable, error)) {
+ return FALSE;
+ }
}
}
+
gs_plugin_status_update (plugin, NULL, GS_PLUGIN_STATUS_FINISHED);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]