textiter: don't call g_utf8_prev_char() on start of string

Changes also the "goto finally" with a break. A break is more common.

Another way is to use g_utf8_find_prev_char().

https://bugzilla.gnome.org/show_bug.cgi?id=638709
This commit is contained in:
Sébastien Wilmet 2014-07-31 14:11:49 +02:00
parent 5041d4507f
commit 6e4e7c22a0

View File

@ -4641,14 +4641,17 @@ utf8_strrcasestr (const gchar *haystack,
p = g_utf8_offset_to_pointer (caseless_haystack, i);
needle_len = strlen (needle);
while (p >= caseless_haystack)
while (TRUE)
{
if (exact_prefix_cmp (p, needle, needle_len))
{
ret = pointer_from_offset_skipping_decomp (haystack, i);
goto finally;
break;
}
if (p == caseless_haystack)
break;
p = g_utf8_prev_char (p);
i--;
}