[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 00:01:11 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
Hi Bruno,
Bruno Haible <address@hidden> writes:
> glibc unfortunately has a big bug in its duplocale function:
> <http://sourceware.org/bugzilla/show_bug.cgi?id=10969>
> 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 function.
Excellent, thanks! Guile now uses the ‘locale’ and ‘duplocale’ modules.
> const char *base_name = nl_langinfo (_NL_LOCALE_NAME (LC_CTYPE));
This is not thread-safe but I guess there’s no other choice.
On a related note, nl_langinfo_l(3) is broken in current glibc:
http://sourceware.org/bugzilla/show_bug.cgi?id=11009
Presumably an ‘nl_langinfo_l’ module could build on the ‘duplocale’
module like this:
--8<---------------cut here---------------start------------->8---
char *
rpl_nl_langinfo_l (nl_item item, locale_t locale)
{
char *result;
locale_t locale_copy;
locale_copy = duplocale (locale);
if (locale_copy != (locale_t) 0)
{
result = nl_langinfo_l (item, locale_copy);
freelocale (locale);
}
else
result = NULL;
return result;
}
--8<---------------cut here---------------end--------------->8---
What do you think?
Thanks,
Ludo’.