# HG changeset patch # User Bruno Haible # Date 1517603654 -3600 # Node ID 2d4269b0a867b7384f9f693003acb651c0bef580 # Parent 6a04b04905e5025eb21c4d40c82cf3811b5a240b 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(). diff -r 6a04b04905e5 -r 2d4269b0a867 ChangeLog --- 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 + + 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 malloca, xmalloca: Make multithread-safe. diff -r 6a04b04905e5 -r 2d4269b0a867 lib/localename.c --- 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