Don't modify the current locale. (#389300)

2006-12-27  Matthias Clasen  <mclasen@redhat.com>

        * glib/gunicollate.c (g_utf8_collate_key): Don't modify
        the current locale.  (#389300)
This commit is contained in:
Matthias Clasen
2006-12-27 05:13:51 +00:00
committed by Matthias Clasen
parent 065cbcb55f
commit 53ca52cebd
2 changed files with 7 additions and 4 deletions

View File

@@ -1,3 +1,8 @@
2006-12-27 Matthias Clasen <mclasen@redhat.com>
* glib/gunicollate.c (g_utf8_collate_key): Don't modify
the current locale. (#389300)
2006-12-24 Matthias Clasen <mclasen@redhat.com>
* tests/run-collate-tests.sh:

View File

@@ -209,18 +209,16 @@ g_utf8_collate_key (const gchar *str,
str_norm = _g_utf8_normalize_wc (str, len, G_NORMALIZE_ALL_COMPOSE);
setlocale (LC_COLLATE, "");
xfrm_len = wcsxfrm (NULL, (wchar_t *)str_norm, 0);
result_wc = g_new (wchar_t, xfrm_len + 1);
wcsxfrm (result_wc, (wchar_t *)str_norm, xfrm_len + 1);
for (i=0; i < xfrm_len; i++)
for (i = 0; i < xfrm_len; i++)
result_len += utf8_encode (NULL, result_wc[i]);
result = g_malloc (result_len + 1);
result_len = 0;
for (i=0; i < xfrm_len; i++)
for (i = 0; i < xfrm_len; i++)
result_len += utf8_encode (result + result_len, result_wc[i]);
result[result_len] = '\0';