blob: 8debe393862a4767f0cd9c49f36dabb05c98af90 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
--- a/lib/gltests/localename.c 2018-02-03 19:27:45.000000000 +0000
+++ b/lib/gltests/localename.c 2018-04-01 15:54:44.383612550 +0000
@@ -40,7 +40,7 @@
# if defined __APPLE__ && defined __MACH__
# include <xlocale.h>
# endif
-# if (__GLIBC__ >= 2 && !defined __UCLIBC__) || defined __CYGWIN__
+# if defined __linux__
# include <langinfo.h>
# endif
# if !defined IN_LIBINTL
@@ -2692,16 +2692,19 @@ gl_locale_name_thread_unsafe (int catego
locale_t thread_locale = uselocale (NULL);
if (thread_locale != LC_GLOBAL_LOCALE)
{
+# if defined(_NL_LOCALE_NAME)
+ const char *name = nl_langinfo(_NL_LOCALE_NAME(category));
# if __GLIBC__ >= 2 && !defined __UCLIBC__
/* Work around an incorrect definition of the _NL_LOCALE_NAME macro in
glibc < 2.12.
See <https://sourceware.org/bugzilla/show_bug.cgi?id=10968>. */
- const char *name =
- nl_langinfo (_NL_ITEM ((category), _NL_ITEM_INDEX (-1)));
+ if (name[0] == '\0')
+ name = nl_langinfo (_NL_ITEM ((category), _NL_ITEM_INDEX (-1)));
if (name[0] == '\0')
/* Fallback code for glibc < 2.4, which did not implement
nl_langinfo (_NL_LOCALE_NAME (category)). */
name = thread_locale->__names[category];
+# endif
return name;
# elif (defined __FreeBSD__ || defined __DragonFly__) || (defined __APPLE__ && defined __MACH__)
/* FreeBSD, Mac OS X */
|