Sources Bugzilla – Bug 10968
_NL_LOCALE_NAME macro does not work
Last modified: 2009-11-17 17:38:40 UTC
In <http://sourceware.org/ml/libc-alpha/2005-03/msg00179.html> a macro
_NL_LOCALE_NAME was introduced, whose purpose it is to access the name
of the current locale. But it does not work: with it, the nl_langinfo
function always returns the empty string.
How to reproduce: Compile and run the attached program bug1.c.
The reason, found by Ludovic Courtès, is that in the macroexpansion of
_NL_ITEM (category, -1) => (((category) << 16) | (-1))
the bits 31..16 of the number -1 overwrite the bits of the category.
The suggested fix therefore is to change the _NL_LOCALE_NAME macro
as indicated in bug1.c.
Created attachment 4387 [details]
Created attachment 4388 [details]
Fixed in git.