On 12 September 2012 19:57, Paul Eggert <egg...@cs.ucla.edu> wrote: > On 09/12/2012 11:29 AM, Ed Maste wrote: >> 2605 locale_t thread_locale = uselocale (NULL); > > I'm afraid you may need to be the guy to debug this. > But if this is returning a value other than LC_GLOBAL_LOCALE > that is a bug, no? POSIX says uselocale (0) should > return LC_GLOBAL_LOCALE if no thread-local locale has > been installed.
This test is setting a thread-local locale: #if HAVE_NEWLOCALE /* Check that gl_locale_name considers the thread locale. */ { locale_t locale = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", NULL); if (locale != NULL) { uselocale (locale); name = gl_locale_name (LC_CTYPE, "LC_CTYPE"); ASSERT (strcmp (name, "fr_FR.UTF-8") == 0); I see what's going on here though - now that the xlocale API exists (as of FreeBSD 9.1) HAVE_NEWLOCALE is true, but there is no FreeBSD implementation in gl_locale_name_thread_unsafe so the function ends up as: gl_locale_name_thread_unsafe (int category, const char *categoryname) { { locale_t thread_locale = uselocale (NULL); if (thread_locale != LC_GLOBAL_LOCALE) { } } return NULL; } which of course isn't going to work well. -Ed