[gnome-software] snap: Only query a metadata item once
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] snap: Only query a metadata item once
- Date: Thu, 2 Jan 2020 14:36:26 +0000 (UTC)
commit 0aa0ce021515bb0bd3febccfcc5154fa084efe2c
Author: Robert Ancell <robert ancell canonical com>
Date: Thu Nov 28 12:59:08 2019 +1300
snap: Only query a metadata item once
plugins/snap/gs-plugin-snap.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/plugins/snap/gs-plugin-snap.c b/plugins/snap/gs-plugin-snap.c
index c6163bf5..c4bf1a6a 100644
--- a/plugins/snap/gs-plugin-snap.c
+++ b/plugins/snap/gs-plugin-snap.c
@@ -584,6 +584,7 @@ gs_plugin_add_alternates (GsPlugin *plugin,
GCancellable *cancellable,
GError **error)
{
+ const gchar *snap_name;
g_autoptr(SnapdSnap) snap = NULL;
GStrv tracks;
GPtrArray *channels;
@@ -593,9 +594,11 @@ gs_plugin_add_alternates (GsPlugin *plugin,
if (g_strcmp0 (gs_app_get_management_plugin (app), "snap") != 0)
return TRUE;
- snap = get_store_snap (plugin, gs_app_get_metadata_item (app, "snap::name"), TRUE, cancellable, NULL);
+ snap_name = gs_app_get_metadata_item (app, "snap::name");
+
+ snap = get_store_snap (plugin, snap_name, TRUE, cancellable, NULL);
if (snap == NULL) {
- g_warning ("Failed to get store snap %s\n", gs_app_get_metadata_item (app, "snap::name"));
+ g_warning ("Failed to get store snap %s\n", snap_name);
return TRUE;
}
@@ -612,7 +615,7 @@ gs_plugin_add_alternates (GsPlugin *plugin,
SnapdChannel *channel = g_ptr_array_index (sorted_channels, i);
g_autoptr(GsApp) a = gs_app_new (NULL);
gs_app_set_bundle_kind (a, AS_BUNDLE_KIND_SNAP);
- gs_app_set_metadata (a, "snap::name", gs_app_get_metadata_item (app, "snap::name"));
+ gs_app_set_metadata (a, "snap::name", snap_name);
gs_app_set_branch (a, snapd_channel_get_name (channel));
gs_app_list_add (list, a);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]