[gnome-software] Do not attempt to refine the GsApp by pkgname if by-id was successfull
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Do not attempt to refine the GsApp by pkgname if by-id was successfull
- Date: Tue, 8 Apr 2014 12:38:59 +0000 (UTC)
commit ded6f9cfa29060a7cdfc6c973f45d4c5883559e8
Author: Richard Hughes <richard hughsie com>
Date: Tue Apr 8 13:30:33 2014 +0100
Do not attempt to refine the GsApp by pkgname if by-id was successfull
This shouldn't change any results, it's just a small optimisation.
src/plugins/gs-plugin-appstream.c | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/src/plugins/gs-plugin-appstream.c b/src/plugins/gs-plugin-appstream.c
index 8f94fd7..848edec 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -491,11 +491,12 @@ out:
static gboolean
gs_plugin_refine_from_id (GsPlugin *plugin,
GsApp *app,
+ gboolean *found,
GError **error)
{
const gchar *id;
gboolean ret = TRUE;
- AsApp *item;
+ AsApp *item = NULL;
/* find anything that matches the ID */
id = gs_app_get_id_full (app);
@@ -510,6 +511,7 @@ gs_plugin_refine_from_id (GsPlugin *plugin,
if (!ret)
goto out;
out:
+ *found = (item != NULL);
return ret;
}
@@ -560,6 +562,7 @@ gs_plugin_refine (GsPlugin *plugin,
GError **error)
{
gboolean ret;
+ gboolean found;
GList *l;
GsApp *app;
@@ -574,15 +577,17 @@ gs_plugin_refine (GsPlugin *plugin,
gs_profile_start (plugin->profile, "appstream::refine");
for (l = *list; l != NULL; l = l->next) {
app = GS_APP (l->data);
- ret = gs_plugin_refine_from_id (plugin, app, error);
+ ret = gs_plugin_refine_from_id (plugin, app, &found, error);
if (!ret) {
gs_profile_stop (plugin->profile, "appstream::refine");
goto out;
}
- ret = gs_plugin_refine_from_pkgname (plugin, app, error);
- if (!ret) {
- gs_profile_stop (plugin->profile, "appstream::refine");
- goto out;
+ if (!found) {
+ ret = gs_plugin_refine_from_pkgname (plugin, app, error);
+ if (!ret) {
+ gs_profile_stop (plugin->profile, "appstream::refine");
+ goto out;
+ }
}
}
gs_profile_stop (plugin->profile, "appstream::refine");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]