Mercurial > gnulib
changeset 39236:2d4269b0a867
localename: Add support for OpenIndiana.
* lib/localename.c (gl_locale_name_thread_unsafe): Add code for
Solaris 11 variants with uselocale() but without getlocalename_l().
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Fri, 02 Feb 2018 21:34:14 +0100 |
parents | 6a04b04905e5 |
children | a675c796ba51 |
files | ChangeLog lib/localename.c |
diffstat | 2 files changed, 26 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Fri Feb 02 19:32:02 2018 +0100 +++ b/ChangeLog Fri Feb 02 21:34:14 2018 +0100 @@ -1,3 +1,9 @@ +2018-02-02 Bruno Haible <bruno@clisp.org> + + localename: Add support for OpenIndiana. + * lib/localename.c (gl_locale_name_thread_unsafe): Add code for + Solaris 11 variants with uselocale() but without getlocalename_l(). + 2018-02-02 Bruno Haible <bruno@clisp.org> malloca, xmalloca: Make multithread-safe.
--- a/lib/localename.c Fri Feb 02 19:32:02 2018 +0100 +++ b/lib/localename.c Fri Feb 02 21:34:14 2018 +0100 @@ -2592,7 +2592,7 @@ #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. */ @@ -2731,9 +2731,27 @@ 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