Remove unused katze_collfold and katze_utf8_stristr

This commit is contained in:
Christian Dywan 2010-09-18 01:48:55 +02:00
parent d0e2433f86
commit 016b6a6306
2 changed files with 0 additions and 99 deletions

View file

@ -1539,95 +1539,3 @@ katze_load_cached_icon (const gchar* uri,
GTK_STOCK_FILE, GTK_ICON_SIZE_MENU, NULL); GTK_STOCK_FILE, GTK_ICON_SIZE_MENU, NULL);
} }
/**
* katze_collfold:
* @str: a non-NULL UTF-8 string
*
* Computes a string without case and decomposited so
* it can be used for comparison.
*
* Return value: a normalized string
*
* Since: 0.2.3
**/
gchar*
katze_collfold (const gchar* str)
{
GString* result = g_string_new (NULL);
const gchar* p = str;
while (*p)
{
gunichar ch = g_unichar_tolower (g_utf8_get_char (p));
gsize len;
gunichar* sch = g_unicode_canonical_decomposition (ch, &len);
guint i = 0;
while (i < len)
g_string_append_unichar (result, sch[i++]);
p = g_utf8_next_char (p);
}
return g_string_free (result, FALSE);
}
/**
* katze_utf8_stristr:
* @haystack: a non-NULL UTF-8 string
* @needle: a normalized non-NULL UTF-8 string
*
* Determines whether @needle is in @haystack, disregarding
* differences in case.
*
* Return value: %TRUE if @needle is found in @haystack
*
* Since: 0.2.3
**/
gboolean
katze_utf8_stristr (const gchar* haystack,
const gchar* needle)
{
#if 0 /* 0,000159 seconds */
/* Too slow for use in completion */
gchar* nhaystack = g_utf8_normalize (haystack, -1, G_NORMALIZE_DEFAULT);
const gchar *p = nhaystack;
gsize len = strlen (needle);
gsize i;
while (*p)
{
for (i = 0; i < len; i++)
if (g_unichar_tolower (g_utf8_get_char (p + i))
!= g_unichar_tolower (g_utf8_get_char (needle + i)))
goto next;
g_free (nhaystack);
return TRUE;
next:
p = g_utf8_next_char (p);
}
g_free (nhaystack);
return FALSE;
#else /* 0,000044 seconds */
/* No unicode matching */
const gchar *p = haystack;
gsize len = strlen (needle);
gsize i;
while (*p)
{
for (i = 0; i < len; i++)
if (g_ascii_tolower (p[i]) != g_ascii_tolower (needle[i]))
goto next;
return TRUE;
next:
p++;
}
return FALSE;
#endif
}

View file

@ -139,13 +139,6 @@ GdkPixbuf*
katze_load_cached_icon (const gchar* uri, katze_load_cached_icon (const gchar* uri,
GtkWidget* widget); GtkWidget* widget);
gchar*
katze_collfold (const gchar* str);
gboolean
katze_utf8_stristr (const gchar* haystack,
const gchar* needle);
G_END_DECLS G_END_DECLS
#endif /* __KATZE_UTILS_H__ */ #endif /* __KATZE_UTILS_H__ */