[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: new module 'duplocale'
From: |
Ludovic Courtès |
Subject: |
Re: new module 'duplocale' |
Date: |
Tue, 24 Nov 2009 09:46:17 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
Hi,
Eric Blake <address@hidden> 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 to
> document that in the various files; for example, note how
> doc/posix-functions/openat.texi mentions that the replacement is not
> thread-safe.
Yes. In this case it’s probably safe to say that it’s the programmer’s
responsibility to do proper locking around uses of the global locale.
>> On a related note, nl_langinfo_l(3) is broken in current glibc:
>>
>> http://sourceware.org/bugzilla/show_bug.cgi?id=11009
>
> For once, I'm tending to agree with Uli - the use of the global locale is
> important for duplocale to create a one-off variant locale, but when it
> comes to all the *_l interfaces, if you want the global locale, then use
> what got returned by duplocale, rather than teaching all the _l interfaces
> to special case the placeholder constant for the global locale.
Hmm, yes. I think it’d have been much easier like this:
#define LC_GLOBAL_LOCALE (&_nl_global_locale)
But I guess the reason it’s not done this way is so qthat
‘_nl_global_locale’ can have ‘hidden’ linkage so that the non-_l
variants don’t pay the penalty. Oh, well.
Thanks,
Ludo’.