summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2015-08-04 09:15:20 +0100
committerRichard Hughes <richard@hughsie.com>2015-08-04 09:15:20 +0100
commit5e6536f796294ca6d327bf7e72017c748876e8e6 (patch)
treed5ea0c7aea21ffcc213e90d5b43ac231ba11f889
parentaf1de105bdf2c0a04a846b5c4eed82079bef4826 (diff)
downloadappstream-glib-5e6536f796294ca6d327bf7e72017c748876e8e6.tar.gz
trivial: Remove the unused as_utils_get_string_overlap()
-rw-r--r--libappstream-glib/as-self-test.c43
-rw-r--r--libappstream-glib/as-utils.c71
-rw-r--r--libappstream-glib/as-utils.h2
3 files changed, 0 insertions, 116 deletions
diff --git a/libappstream-glib/as-self-test.c b/libappstream-glib/as-self-test.c
index 247cfca..00cfdf8 100644
--- a/libappstream-glib/as-self-test.c
+++ b/libappstream-glib/as-self-test.c
@@ -3210,48 +3210,6 @@ as_test_store_speed_desktop_func (void)
}
static void
-as_test_utils_overlap_func (void)
-{
- gchar *tmp;
-
- /* same */
- tmp = as_utils_get_string_overlap ("dave.ttf", "dave.ttf");
- g_assert_cmpstr (tmp, ==, "dave.ttf");
- g_free (tmp);
-
- /* only prefix */
- tmp = as_utils_get_string_overlap ("dave.ttf", "daniel.doc");
- g_assert_cmpstr (tmp, ==, "da");
- g_free (tmp);
-
- /* only suffix */
- tmp = as_utils_get_string_overlap ("dave.ttf", "sara.ttf");
- g_assert_cmpstr (tmp, ==, ".ttf");
- g_free (tmp);
-
- /* different */
- tmp = as_utils_get_string_overlap ("dave.ttf", "bob.doc");
- g_assert_cmpstr (tmp, ==, NULL);
- g_free (tmp);
-
- /* long left */
- tmp = as_utils_get_string_overlap ("aaabbbccc.ttf", "bbbccc.ttf");
- g_assert_cmpstr (tmp, ==, "bbbccc.ttf");
- g_free (tmp);
-
- /* long right */
- tmp = as_utils_get_string_overlap ("bbbccc.ttf", "aaabbbccc.ttf");
- g_assert_cmpstr (tmp, ==, "bbbccc.ttf");
- g_free (tmp);
-
- /* extra dots */
- tmp = as_utils_get_string_overlap ("org.gnome.Music.Player.desktop",
- "org.gnome.Music.Record.desktop");
- g_assert_cmpstr (tmp, ==, "org.gnome.Music.desktop");
- g_free (tmp);
-}
-
-static void
as_test_utils_icons_func (void)
{
gchar *tmp;
@@ -4239,7 +4197,6 @@ main (int argc, char **argv)
g_test_add_func ("/AppStream/node{intltool}", as_test_node_intltool_func);
g_test_add_func ("/AppStream/node{sort}", as_test_node_sort_func);
g_test_add_func ("/AppStream/utils", as_test_utils_func);
- g_test_add_func ("/AppStream/utils{overlap}", as_test_utils_overlap_func);
g_test_add_func ("/AppStream/utils{icons}", as_test_utils_icons_func);
g_test_add_func ("/AppStream/utils{spdx-token}", as_test_utils_spdx_token_func);
g_test_add_func ("/AppStream/utils{install-filename}", as_test_utils_install_filename_func);
diff --git a/libappstream-glib/as-utils.c b/libappstream-glib/as-utils.c
index 6033328..3c63860 100644
--- a/libappstream-glib/as-utils.c
+++ b/libappstream-glib/as-utils.c
@@ -1082,77 +1082,6 @@ as_utils_find_icon_filename (const gchar *destdir,
}
/**
- * as_utils_get_string_overlap_prefix:
- */
-static gchar *
-as_utils_get_string_overlap_prefix (const gchar *s1, const gchar *s2)
-{
- guint i;
- for (i = 0; s1[i] != '\0' && s2[i] != '\0'; i++) {
- if (s1[i] != s2[i])
- break;
- }
- if (i == 0)
- return NULL;
- if (s1[i - 1] == '-' || s1[i - 1] == '.')
- i--;
- return g_strndup (s1, i);
-}
-
-/**
- * as_utils_get_string_overlap_suffix:
- */
-static gchar *
-as_utils_get_string_overlap_suffix (const gchar *s1, const gchar *s2)
-{
- guint i;
- guint len1 = strlen (s1);
- guint len2 = strlen (s2);
- for (i = 0; i <= len1 && i <= len2; i++) {
- if (s1[len1 - i] != s2[len2 - i])
- break;
- }
- if (i <= 1)
- return NULL;
- return g_strdup (&s1[len1 - i + 1]);
-}
-
-/**
- * as_utils_get_string_overlap:
- * @s1: A string.
- * @s2: Another string
- *
- * Return a prefix and sufffix that is common to both strings.
- *
- * Returns: (transfer full): a newly allocated %NULL terminated string, or %NULL
- *
- * Since: 0.3.1
- */
-gchar *
-as_utils_get_string_overlap (const gchar *s1, const gchar *s2)
-{
- _cleanup_free_ gchar *prefix = NULL;
- _cleanup_free_ gchar *suffix = NULL;
-
- g_return_val_if_fail (s1 != NULL, NULL);
- g_return_val_if_fail (s2 != NULL, NULL);
-
- /* same? */
- if (g_strcmp0 (s1, s2) == 0)
- return g_strdup (s1);
-
- prefix = as_utils_get_string_overlap_prefix (s1, s2);
- suffix = as_utils_get_string_overlap_suffix (s1, s2);
- if (prefix == NULL && suffix == NULL)
- return NULL;
- if (prefix != NULL && suffix == NULL)
- return g_strdup (prefix);
- if (prefix == NULL && suffix != NULL)
- return g_strdup (suffix);
- return g_strdup_printf ("%s%s", prefix, suffix);
-}
-
-/**
* as_utils_location_get_prefix:
**/
static const gchar *
diff --git a/libappstream-glib/as-utils.h b/libappstream-glib/as-utils.h
index 7de17fb..62e0ffc 100644
--- a/libappstream-glib/as-utils.h
+++ b/libappstream-glib/as-utils.h
@@ -117,8 +117,6 @@ gchar *as_utils_find_icon_filename_full (const gchar *destdir,
const gchar *search,
AsUtilsFindIconFlag flags,
GError **error);
-gchar *as_utils_get_string_overlap (const gchar *s1,
- const gchar *s2);
gboolean as_utils_install_filename (AsUtilsLocation location,
const gchar *filename,
const gchar *origin,