summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2018-05-21 17:07:06 +0100
committerRichard Hughes <richard@hughsie.com>2018-05-21 17:15:10 +0100
commit01682237f69740c4c2e0501ea3c87daeeaca0f33 (patch)
tree2fe796b0ff791e69c254800ca30659cb5e62accb
parent0f0b783b29abea97879295e5c9f0cbdb085e18c7 (diff)
downloadappstream-glib-01682237f69740c4c2e0501ea3c87daeeaca0f33.tar.gz
trivial: Do not store hundreds of duplicate AsApp icon path strings
-rw-r--r--libappstream-glib/as-app-private.h2
-rw-r--r--libappstream-glib/as-app.c7
-rw-r--r--libappstream-glib/as-store.c2
3 files changed, 10 insertions, 1 deletions
diff --git a/libappstream-glib/as-app-private.h b/libappstream-glib/as-app-private.h
index 0d81cd5..8231718 100644
--- a/libappstream-glib/as-app-private.h
+++ b/libappstream-glib/as-app-private.h
@@ -125,6 +125,8 @@ void as_app_set_stemmer (AsApp *app,
AsStemmer *stemmer);
void as_app_set_search_blacklist (AsApp *app,
GHashTable *search_blacklist);
+void as_app_set_icon_path_rstr (AsApp *app,
+ AsRefString *rstr);
G_END_DECLS
diff --git a/libappstream-glib/as-app.c b/libappstream-glib/as-app.c
index 6b9d4e5..b59984d 100644
--- a/libappstream-glib/as-app.c
+++ b/libappstream-glib/as-app.c
@@ -2690,6 +2690,13 @@ as_app_set_origin (AsApp *app, const gchar *origin)
priv->unique_id_valid = FALSE;
}
+void
+as_app_set_icon_path_rstr (AsApp *app, AsRefString *rstr)
+{
+ AsAppPrivate *priv = GET_PRIVATE (app);
+ as_ref_string_assign (&priv->icon_path, rstr);
+}
+
/**
* as_app_set_icon_path:
* @app: a #AsApp instance.
diff --git a/libappstream-glib/as-store.c b/libappstream-glib/as-store.c
index 7d44fcd..4a2329c 100644
--- a/libappstream-glib/as-store.c
+++ b/libappstream-glib/as-store.c
@@ -1644,7 +1644,7 @@ as_store_from_root (AsStore *store,
app = as_app_new ();
if (icon_path_str != NULL)
- as_app_set_icon_path (app, icon_path_str);
+ as_app_set_icon_path_rstr (app, icon_path_str);
if (arch != NULL)
as_app_add_arch (app, arch);
as_app_add_format (app, format);