diff options
author | Richard Hughes <richard@hughsie.com> | 2018-05-18 15:09:19 +0100 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2018-05-21 17:16:29 +0100 |
commit | f0f46f9bdc6ea6533dace779826f371718e62c91 (patch) | |
tree | 310f1b5d52b25418c5c0f2ab7ac6d809c2dc2f3f | |
parent | 6782a91adeb876dddb7501d00ed51eb9ce75d6eb (diff) | |
download | appstream-glib-f0f46f9bdc6ea6533dace779826f371718e62c91.tar.gz |
trivial: Do not store hundreds of duplicate AsIcon prefix strings
-rw-r--r-- | libappstream-glib/as-app.c | 2 | ||||
-rw-r--r-- | libappstream-glib/as-icon-private.h | 3 | ||||
-rw-r--r-- | libappstream-glib/as-icon.c | 7 |
3 files changed, 11 insertions, 1 deletions
diff --git a/libappstream-glib/as-app.c b/libappstream-glib/as-app.c index 49f3e30..43a0008 100644 --- a/libappstream-glib/as-app.c +++ b/libappstream-glib/as-app.c @@ -5020,7 +5020,7 @@ as_app_node_parse_child (AsApp *app, GNode *n, guint32 flags, { g_autoptr(AsIcon) ic = NULL; ic = as_icon_new (); - as_icon_set_prefix (ic, priv->icon_path); + as_icon_set_prefix_rstr (ic, priv->icon_path); if (!as_icon_node_parse (ic, n, ctx, error)) return FALSE; as_app_add_icon (app, ic); diff --git a/libappstream-glib/as-icon-private.h b/libappstream-glib/as-icon-private.h index 0c7af74..df6f891 100644 --- a/libappstream-glib/as-icon-private.h +++ b/libappstream-glib/as-icon-private.h @@ -47,6 +47,9 @@ gboolean as_icon_node_parse_dep11 (AsIcon *icon, AsNodeContext *ctx, GError **error); +void as_icon_set_prefix_rstr (AsIcon *icon, + AsRefString *rstr); + G_END_DECLS #endif /* __AS_ICON_PRIVATE_H */ diff --git a/libappstream-glib/as-icon.c b/libappstream-glib/as-icon.c index 8a13ae0..ae15dc4 100644 --- a/libappstream-glib/as-icon.c +++ b/libappstream-glib/as-icon.c @@ -363,6 +363,13 @@ as_icon_set_prefix (AsIcon *icon, const gchar *prefix) as_ref_string_assign_safe (&priv->prefix, prefix); } +void +as_icon_set_prefix_rstr (AsIcon *icon, AsRefString *rstr) +{ + AsIconPrivate *priv = GET_PRIVATE (icon); + as_ref_string_assign (&priv->prefix, rstr); +} + /** * as_icon_set_url: * @icon: a #AsIcon instance. |