diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2018-03-07 05:31:29 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2018-03-07 05:31:29 +0100 |
commit | 69bb64199daa7706d4b74d13b65d88ba8aab5e57 (patch) | |
tree | 55f95f9bd36ff038dc60f1f6994baef78d735ba9 /lib/localename.c | |
parent | 0cb66c451a1a4e717878b8296b79c8d7cfd38b30 (diff) | |
parent | f7c3580478601e3a77dc864e5a1d91c1edad5187 (diff) |
Update upstream source from tag 'upstream/0.9.9'
Update to upstream version '0.9.9'
with Debian dir 17ff42c74c83731ce6c9bc739436c59103f706be
Diffstat (limited to 'lib/localename.c')
-rw-r--r-- | lib/localename.c | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/lib/localename.c b/lib/localename.c index 59732fa..85960c0 100644 --- a/lib/localename.c +++ b/lib/localename.c @@ -1,5 +1,5 @@ /* Determine name of the currently selected locale. - Copyright (C) 1995-2017 Free Software Foundation, Inc. + Copyright (C) 1995-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of either: @@ -49,7 +49,7 @@ # if defined __APPLE__ && defined __MACH__ # include <xlocale.h> # endif -# if (__GLIBC__ >= 2 && !defined __UCLIBC__) || defined __CYGWIN__ +# if (__GLIBC__ >= 2 && !defined __UCLIBC__) || (defined __linux__ && HAVE_LANGINFO_H) || defined __CYGWIN__ # include <langinfo.h> # endif # if !defined IN_LIBINTL @@ -2601,7 +2601,7 @@ get_lcid (const char *locale_name) #endif -#if HAVE_USELOCALE /* glibc, Solaris >= 12 or Mac OS X */ +#if HAVE_USELOCALE /* glibc, Mac OS X, Solaris 11 OpenIndiana, or Solaris 12 */ /* Simple hash set of strings. We don't want to drag in lots of hash table code here. */ @@ -2712,6 +2712,9 @@ gl_locale_name_thread_unsafe (int category, const char *categoryname) nl_langinfo (_NL_LOCALE_NAME (category)). */ name = thread_locale->__names[category]; return name; +# elif defined __linux__ && HAVE_LANGINFO_H && defined NL_LOCALE_NAME + /* musl libc */ + return nl_langinfo_l (NL_LOCALE_NAME (category), thread_locale); # elif (defined __FreeBSD__ || defined __DragonFly__) || (defined __APPLE__ && defined __MACH__) /* FreeBSD, Mac OS X */ int mask; @@ -2740,9 +2743,27 @@ gl_locale_name_thread_unsafe (int category, const char *categoryname) return ""; } return querylocale (mask, thread_locale); -# elif defined __sun && HAVE_GETLOCALENAME_L +# elif defined __sun +# if HAVE_GETLOCALENAME_L /* Solaris >= 12. */ return getlocalename_l (category, thread_locale); +# else + /* Solaris 11 OpenIndiana. + For the internal structure of locale objects, see + https://github.com/OpenIndiana/illumos-gate/blob/master/usr/src/lib/libc/port/locale/localeimpl.h */ + switch (category) + { + case LC_CTYPE: + case LC_NUMERIC: + case LC_TIME: + case LC_COLLATE: + case LC_MONETARY: + case LC_MESSAGES: + return ((const char * const *) thread_locale)[category]; + default: /* We shouldn't get here. */ + return ""; + } +# endif # elif defined __CYGWIN__ /* Cygwin < 2.6 lacks uselocale and thread-local locales altogether. Cygwin <= 2.6.1 lacks NL_LOCALE_NAME, requiring peeking inside |