+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.
#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. */
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