diff options
author | Richard Hughes <richard@hughsie.com> | 2016-03-03 13:42:59 +0000 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2016-03-03 17:39:01 +0000 |
commit | 4160f8b48ca7a3f06e0865d5bc40736daa5bb7a0 (patch) | |
tree | 1d670a9c6073051dd27eb0398e356aec62034cbc /libappstream-glib/as-node.c | |
parent | 45406dd91959729e0f8935cf864f70f291801489 (diff) | |
download | appstream-glib-4160f8b48ca7a3f06e0865d5bc40736daa5bb7a0.tar.gz |
Add as_utils_string_replace()
This is used all over the place both in and out of tree.
Diffstat (limited to 'libappstream-glib/as-node.c')
-rw-r--r-- | libappstream-glib/as-node.c | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/libappstream-glib/as-node.c b/libappstream-glib/as-node.c index 820a9ed..340ee1e 100644 --- a/libappstream-glib/as-node.c +++ b/libappstream-glib/as-node.c @@ -173,25 +173,6 @@ as_node_unref (AsNode *node) G_DEFINE_QUARK (as-node-error-quark, as_node_error) /** - * as_node_string_replace: - **/ -static void -as_node_string_replace (GString *string, const gchar *search, const gchar *replace) -{ - g_autofree gchar *tmp = NULL; - g_auto(GStrv) split = NULL; - - /* quick search */ - if (g_strstr_len (string->str, -1, search) == NULL) - return; - - /* replace */ - split = g_strsplit (string->str, search, -1); - tmp = g_strjoinv (replace, split); - g_string_assign (string, tmp); -} - -/** * as_node_string_replace_inplace: **/ static void @@ -241,9 +222,9 @@ as_node_cdata_to_escaped (AsNodeData *data) return; str = g_string_new (data->cdata); g_free (data->cdata); - as_node_string_replace (str, "&", "&"); - as_node_string_replace (str, "<", "<"); - as_node_string_replace (str, ">", ">"); + as_utils_string_replace (str, "&", "&"); + as_utils_string_replace (str, "<", "<"); + as_utils_string_replace (str, ">", ">"); data->cdata = g_string_free (str, FALSE); data->cdata_escaped = TRUE; } |