Re: new module 'duplocale'

2009-11-24 Thread Ludovic Courtès
Hi Bruno, Bruno Haible writes: >> > const char *base_name = nl_langinfo (_NL_LOCALE_NAME (LC_CTYPE)); >> >> This is not thread-safe but I guess there’s no other choice. > > This code is only used on glibc systems, and nl_langinfo is multithread-safe > on glibc systems (by code inspection

Re: new module 'duplocale'

2009-11-24 Thread Bruno Haible
Hi Ludovic, > > const char *base_name = nl_langinfo (_NL_LOCALE_NAME (LC_CTYPE)); > > This is not thread-safe but I guess there’s no other choice. This code is only used on glibc systems, and nl_langinfo is multithread-safe on glibc systems (by code inspection and due to the way it mmaps t

Re: new module 'duplocale'

2009-11-24 Thread Bruno Haible
> + base_name = nl_langinfo (_NL_LOCALE_NAME (LC_CTYPE)); > + if (base_name[0] == '\0') > + /* Fallback code for glibc < 2.4, which did not implement > +nl_langinfo (_NL_LOCALE_NAME (category)). */ > + base_name = setlocale (LC_CTYPE, NULL); Oops, the use of nl_langinf

Re: new module 'duplocale'

2009-11-24 Thread Ludovic Courtès
Hi, Eric Blake writes: > According to Ludovic Courtès on 11/23/2009 4:01 PM: >>> const char *base_name = nl_langinfo (_NL_LOCALE_NAME (LC_CTYPE)); >> >> This is not thread-safe but I guess there’s no other choice. > > As is the case with a number of gnulib modules. But I have been trying

Re: new module 'duplocale'

2009-11-23 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Ludovic Courtès on 11/23/2009 4:01 PM: >> const char *base_name = nl_langinfo (_NL_LOCALE_NAME (LC_CTYPE)); > > This is not thread-safe but I guess there’s no other choice. As is the case with a number of gnulib modules. But I hav

Re: new module 'duplocale'

2009-11-23 Thread Ludovic Courtès
Hi Bruno, Bruno Haible writes: > glibc unfortunately has a big bug in its duplocale function: > > This module provides a workaround for it. Tested on glibc and MacOS X systems, > which are AFAIK the only systems so far with a duplocale fun

Re: new module 'duplocale'

2009-11-23 Thread Bruno Haible
This code would not work all right on glibc 2.3.x systems, when setlocale has been called with an argument different from "". This should fix it. 2009-11-23 Bruno Haible duplocale: Add support for glibc 2.3.x. * lib/duplocale.c (rpl_duplocale): Add fallback code for glibc 2.3.x